Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > No Print output

Reply
Thread Tools

No Print output

 
 
William
Guest
Posts: n/a
 
      12-03-2005
my objective is to get the "desk" using the CGI script accmgr.

in display.pl:

61 $desk='/mkapp/webapps/mxrt-cgi/accmgr?action=getDesk';
62 print $desk;

in accmgr:
71 elsif ($ACTION eq "getDesk") {
72 $STATUS_MSG=getDesk();
73 }

553 # get the desk from user.cfg and return this desk to display.pl to
show/hide radio buttons
554 sub getDesk{
555 return $USERS{$Group};
556 }



my question: why is there no print outout on line 62 of display.pl?
i.e. print $desk;


 
Reply With Quote
 
 
 
 
Gunnar Hjalmarsson
Guest
Posts: n/a
 
      12-03-2005
William wrote:
> my objective is to get the "desk" using the CGI script accmgr.
>
> in display.pl:
>
> 61 $desk='/mkapp/webapps/mxrt-cgi/accmgr?action=getDesk';
> 62 print $desk;
>
> in accmgr:
> 71 elsif ($ACTION eq "getDesk") {
> 72 $STATUS_MSG=getDesk();
> 73 }
>
> 553 # get the desk from user.cfg and return this desk to display.pl to
> show/hide radio buttons
> 554 sub getDesk{
> 555 return $USERS{$Group};
> 556 }
>
>
>
> my question: why is there no print outout on line 62 of display.pl?
> i.e. print $desk;


Because of the error on line 139.

http://mail.augustmail.com/~tadmc/cl...uidelines.html

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
 
Reply With Quote
 
 
 
 
Sherm Pendley
Guest
Posts: n/a
 
      12-03-2005
William <(E-Mail Removed)> writes:

> my objective is to get the "desk" using the CGI script accmgr.


Never heard of it.

> in display.pl:
>
> 61 $desk='/mkapp/webapps/mxrt-cgi/accmgr?action=getDesk';
> 62 print $desk;


Okay.

> in accmgr:
> 71 elsif ($ACTION eq "getDesk") {
> 72 $STATUS_MSG=getDesk();
> 73 }


How is that related to what's in display.pl?

> 553 # get the desk from user.cfg and return this desk to display.pl to
> show/hide radio buttons
> 554 sub getDesk{
> 555 return $USERS{$Group};
> 556 }


Once again... how is that related?

> my question: why is there no print outout on line 62 of display.pl?


There *is* output printed there. $desk is assigned a literal value, so
there's no possibility of it being empty.

What's happening to that output after it's printed is an option question,
and impossible to determine from the tiny snippets of code you've given
us to work with.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
 
Reply With Quote
 
William
Guest
Posts: n/a
 
      12-04-2005
>> > in accmgr:
> > 71 elsif ($ACTION eq "getDesk") {
> > 72 $STATUS_MSG=getDesk();
> > 73 }

>
> How is that related to what's in display.pl?


in display.pl, i am calling accmgr with the action of "getDesk", which
runs the elsif on line 71.


accmgr:
> > 553 # get the desk from user.cfg and return this desk to

display.pl to
> > show/hide radio buttons
> > 554 sub getDesk{
> > 555 return $USERS{$Group};
> > 556 }

> Once again... how is that related?


line 72 of accmgr calls getDesk of accmgr (line 554-556), then returns the
value to line 61 of display.pl.

but in line 62 of display.pl, nothing gets printed.

WHY?



On Sat, 3 Dec 2005, Sherm Pendley wrote:

> William <(E-Mail Removed)> writes:
>
> > my objective is to get the "desk" using the CGI script accmgr.

>
> Never heard of it.
>
> > in display.pl:
> >
> > 61 $desk='/mkapp/webapps/mxrt-cgi/accmgr?action=getDesk';
> > 62 print $desk;

>
> Okay.
>
> > in accmgr:
> > 71 elsif ($ACTION eq "getDesk") {
> > 72 $STATUS_MSG=getDesk();
> > 73 }

>
> How is that related to what's in display.pl?
>
> > 553 # get the desk from user.cfg and return this desk to display.pl to
> > show/hide radio buttons
> > 554 sub getDesk{
> > 555 return $USERS{$Group};
> > 556 }

>
> Once again... how is that related?
>
> > my question: why is there no print outout on line 62 of display.pl?

>
> There *is* output printed there. $desk is assigned a literal value, so
> there's no possibility of it being empty.
>
> What's happening to that output after it's printed is an option question,
> and impossible to determine from the tiny snippets of code you've given
> us to work with.
>
> sherm--
>
> --
> Cocoa programming in Perl: http://camelbones.sourceforge.net
> Hire me! My resume: http://www.dot-app.org
>

 
Reply With Quote
 
Dr.Ruud
Guest
Posts: n/a
 
      12-04-2005
William schreef:

> 61 $desk='/mkapp/webapps/mxrt-cgi/accmgr?action=getDesk';
> 62 print $desk;
>
> my question: why is there no print outout on line 62 of display.pl?
> i.e. print $desk;


Is there a select-call active?
perldoc -f select

--
Affijn, Ruud

"Gewoon is een tijger."
 
Reply With Quote
 
Sherm Pendley
Guest
Posts: n/a
 
      12-04-2005
William <(E-Mail Removed)> writes:

> but in line 62 of display.pl, nothing gets printed.
>
> WHY?


As I said before, it's:

>> impossible to determine from the tiny snippets of code you've given
>> us to work with.


Have you read the posting guidelines that appear here frequently? They
suggest posting the smallest *working* example that *illustrates* the
problem. You haven't done that. You've simply copied some lines that may
or may not be relevant, out of a script you're assuming everyone here is
familiar with.

No one here can help you, unless you help us help you.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
 
Reply With Quote
 
William
Guest
Posts: n/a
 
      12-04-2005
to illustrate display.pl:

1 #!/usr/bin/perl
2
3 require "../accmgr";
4
5 use Sys::Hostname;
6 use File::Basename;
7 use File::stat;
8 use Time::localtime;
9 use CGI;
10 use CGI::Carp qw(fatalsToBrowser);
11
12 print "Content-type: text/html\n\n";
13 print "<html><title>Form Upload</title><body>\n";
14
15
16 $file = "/mkapp/webapps/mxrt/html/upload_repo.html";
17
18 open(IN, "$file");
19 @lines = <IN>;
20 close(IN);
21
22 print @lines;
23
24 # need to get accmgr to pass the userid's desk back to this file
25 $desk='/mkapp/webapps/mxrt-cgi/accmgr?action=getDesk';
26 print $desk;
27
28 ############ use $desk to dynamically generate the set of radio
buttons
29 # loop thru $file
30 # if <IN> = <input type="radio" name="desk"
value="BO"> BO
31 # compare value to (e.g. $desk ?= BO )
32 # if not match, skip this line
33 # if match, print this line
34
35 print "</body></html>";

accmgr:


#!/usr/bin/perl

# accmgr
#
# The script manages the access (login/passwords/ACL) to define which
users
# have access to what functionality. In addition, it supports self
# registration and password changes.

require "./mxrt_vars.pl";
require "./mxrt_auth.pl";
require "/mkapp/webapps/mxrt-cgi/dbConn.pl";


use File::stat;
use File::Basename;
use Time::Local;
#use Time::localtime;
use CGI;
use CGI::Carp qw(fatalsToBrowser);

my $query = new CGI;

@GROUPS = qw(BO FO LFO SYS);


sub loadUserCfg {
$USERCFG_MTIME = stat($MXUSERCFGFILE)->mtime;

open(USERCFGFILE, "<$MXUSERCFGFILE") or
return "Unable to access User config file:".$MXUSERCFGFILE."<br>
Please try again later.";

%USERS = ();
undef @USER_DETAIL_KEYS;
undef @USER_DETAIL_VALS;
while (<USERCFGFILE>) {
chomp; # no newline
s/#.*//; # no comments
s/^\s+//; # no leading white
s/\s+$//; # no trailing white
next unless length; # anything left?
my ($var, $value) = split(/\s*=\s*/, $_, 2);
if ($var eq "UserID") {
# this is the header definitions
@USER_DETAIL_KEYS = split(':', $value);
#print "@USER_DETAIL_KEYS"."<br>";
}
else {
@USER_DETAIL_VALS = split(':', $value);
#print "@USER_DETAIL_VALS"."<br>";
my $count=0;
foreach $key (@USER_DETAIL_KEYS) {
$USERS{$var}{$key} = $USER_DETAIL_VALS[$count++];
}
}
}
close USERCFGFILE;

#foreach $user (keys %USERS) {
# foreach $key (@USER_DETAIL_KEYS) {
# print $user, $key, $USERS{$user}{$key}, "<br>";
# }
#}

return "";
}


# get the desk from user.cfg and return this desk to display.pl to
show/hide radio buttons
sub getDesk{
return $USERS{$Group}; # $Group is one of {BO FO LFO SYS}
}



On Sat, 3 Dec 2005, William wrote:

> >> > in accmgr:
> > > 71 elsif ($ACTION eq "getDesk") {
> > > 72 $STATUS_MSG=getDesk();
> > > 73 }

> >
> > How is that related to what's in display.pl?

>
> in display.pl, i am calling accmgr with the action of "getDesk", which
> runs the elsif on line 71.
>
>
> accmgr:
> > > 553 # get the desk from user.cfg and return this desk to

> display.pl to
> > > show/hide radio buttons
> > > 554 sub getDesk{
> > > 555 return $USERS{$Group};
> > > 556 }

> > Once again... how is that related?

>
> line 72 of accmgr calls getDesk of accmgr (line 554-556), then returns the
> value to line 61 of display.pl.
>
> but in line 62 of display.pl, nothing gets printed.
>
> WHY?
>
>
>
> On Sat, 3 Dec 2005, Sherm Pendley wrote:
>
> > William <(E-Mail Removed)> writes:
> >
> > > my objective is to get the "desk" using the CGI script accmgr.

> >
> > Never heard of it.
> >
> > > in display.pl:
> > >
> > > 61 $desk='/mkapp/webapps/mxrt-cgi/accmgr?action=getDesk';
> > > 62 print $desk;

> >
> > Okay.
> >
> > > in accmgr:
> > > 71 elsif ($ACTION eq "getDesk") {
> > > 72 $STATUS_MSG=getDesk();
> > > 73 }

> >
> > How is that related to what's in display.pl?
> >
> > > 553 # get the desk from user.cfg and return this desk to display.pl to
> > > show/hide radio buttons
> > > 554 sub getDesk{
> > > 555 return $USERS{$Group};
> > > 556 }

> >
> > Once again... how is that related?
> >
> > > my question: why is there no print outout on line 62 of display.pl?

> >
> > There *is* output printed there. $desk is assigned a literal value, so
> > there's no possibility of it being empty.
> >
> > What's happening to that output after it's printed is an option question,
> > and impossible to determine from the tiny snippets of code you've given
> > us to work with.
> >
> > sherm--
> >
> > --
> > Cocoa programming in Perl: http://camelbones.sourceforge.net
> > Hire me! My resume: http://www.dot-app.org
> >

>

 
Reply With Quote
 
William
Guest
Posts: n/a
 
      12-04-2005
I added
select STDOUT;
print $desk;

but still no output.


On Sun, 4 Dec 2005, Dr.Ruud wrote:

> William schreef:
>
> > 61 $desk='/mkapp/webapps/mxrt-cgi/accmgr?action=getDesk';
> > 62 print $desk;
> >
> > my question: why is there no print outout on line 62 of display.pl?
> > i.e. print $desk;

>
> Is there a select-call active?
> perldoc -f select
>
> --
> Affijn, Ruud
>
> "Gewoon is een tijger."
>

 
Reply With Quote
 
Sherm Pendley
Guest
Posts: n/a
 
      12-04-2005
William <(E-Mail Removed)> writes:

Upside-down - please stop that. Haven't you read the posting guidelines yet?

> to illustrate display.pl:


What's up with the line numbers? This is Perl, not BASIC.

>
> 1 #!/usr/bin/perl


Always ask Perl for as much help as it can give you.

use strict;
use warnings;

These should appear first, so the CGI::Carp will be able to tell you if
one of the other uses or requires fails.

> 9 use CGI;
> 10 use CGI::Carp qw(fatalsToBrowser);


> 2
> 3 require "../accmgr";
> 4
> 5 use Sys::Hostname;
> 6 use File::Basename;
> 7 use File::stat;
> 8 use Time::localtime;
> 11
> 12 print "Content-type: text/html\n\n";
> 13 print "<html><title>Form Upload</title><body>\n";
> 14
> 15
> 16 $file = "/mkapp/webapps/mxrt/html/upload_repo.html";
> 17
> 18 open(IN, "$file");


# Always - yes, *ALWAYS* check the return value of open()
# Also, quoting $file is unnecessary here - see "perldoc -q always"

open(IN, $file) or die "Could not open $file: $!";

> 19 @lines = <IN>;
> 20 close(IN);
> 21
> 22 print @lines;
> 23
> 24 # need to get accmgr to pass the userid's desk back to this file
> 25 $desk='/mkapp/webapps/mxrt-cgi/accmgr?action=getDesk';


This will print the string you've assigned to $desk above. Is it printing
something else? Did you *expect* it to print something else? If so, what
did you expect it to print?

Use your browser's "view source" function to view what's actually being
printed - if there is broken and/or missing HTML markup, there could be
text that your browser isn't showing you.

I *think* what you might be expecting is a call to the getDesk() function
that's found in accmgr - if that's the case, then you're *way* off track,
and you need to have a look at:

perldoc -f require
perldoc perlsub
perldoc perlmod

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
 
Reply With Quote
 
Joe Smith
Guest
Posts: n/a
 
      12-04-2005
William wrote:

> 25 $desk='/mkapp/webapps/mxrt-cgi/accmgr?action=getDesk';
> 26 print $desk;


Do you understand the distinction between

$desk='/mkapp/webapps/mxrt-cgi/accmgr?action=getDesk';

and

$desk=`/mkapp/webapps/mxrt-cgi/accmgr?action=getDesk`;

? And are you aware that one CGI program cannot call another
CGI program using the syntax you're using?

It appears that you are under the mistaken impression that
a perl script treats URLs the same way that a browser does.

For URLs pointing to an external server, use LWP::Simple.
For CGI scripts running on the same server as the perl script,
you have to set up the right environment before executing
the second script, and use either backticks or pipe to read
the results.

-Joe
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
print a vs print '%s' % a vs print '%f' a David Cournapeau Python 0 12-30-2008 03:19 AM
Re: Problem - I want to print Current Output of Pdf file and shouldprint once.I get print dialog box but it is not working Lew Java 0 05-30-2007 01:31 PM
Problem - I want to print Current Output of Pdf file and should print once.I get print dialog box but it is not working keto Java 0 05-30-2007 11:27 AM
Can't print to print server =?Utf-8?B?cGVjaw==?= Wireless Networking 2 02-03-2005 02:41 PM
Unlarging the print to print using PDF file to print Bun Mui Computer Support 3 09-13-2004 03:15 AM



Advertisments