[26617] in Perl-Users-Digest
Perl-Users Digest, Issue: 8729 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Dec 4 00:05:32 2005
Date: Sat, 3 Dec 2005 21:05:06 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 3 Dec 2005 Volume: 10 Number: 8729
Today's topics:
Re: A question of hashes in a module. <invalid@nowhere.com>
Re: IO::Socket help xhoster@gmail.com
Re: IO::Socket help <1usa@llenroc.ude.invalid>
Re: IO::Socket help <ves@ves.net>
migrate data tables <noone@nowhere.net>
No Print output <wh2leung@student.cs.uwaterloo.ca>
Re: No Print output <noreply@gunnar.cc>
Re: No Print output <sherm@dot-app.org>
Re: No Print output <wh2leung@student.cs.uwaterloo.ca>
Re: No Print output <sherm@dot-app.org>
Re: No Print output <rvtol+news@isolution.nl>
Re: No Print output <wh2leung@student.cs.uwaterloo.ca>
Re: No Print output <wh2leung@student.cs.uwaterloo.ca>
Re: No Print output <sherm@dot-app.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 03 Dec 2005 14:37:43 -0600
From: Don Gatlin <invalid@nowhere.com>
Subject: Re: A question of hashes in a module.
Message-Id: <pan.2005.12.03.20.37.41.898104@nowhere.com>
> perldoc perlreftut
>
Ok, I admit it - I made a mistake in not getting perldoc back when I
started Perl (although the reason is still valid). It is really good and
drenched with info that is not in my $$$ collection of perl books,
although some of it can be very deep even after several readings.
Definitely worth tying up my phone line for half a night.
So the rule for a perl newbie, is RTFPD :)
Thanks again
Don
------------------------------
Date: 03 Dec 2005 23:27:52 GMT
From: xhoster@gmail.com
Subject: Re: IO::Socket help
Message-Id: <20051203182752.639$HH@newsreader.com>
Vespasian <ves@ves.net> wrote:
> Why does the following code correctly sets up a server
>
...
>
> while the following does not i.e. it dies at the die statement,
I'm guessing that the reason that it dies at the die statement would
have be reflected in the contents of $! at the die statement. Why
have you concealed this from us?
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Sat, 03 Dec 2005 23:43:26 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: IO::Socket help
Message-Id: <Xns9721BE7C24201asu1cornelledu@127.0.0.1>
xhoster@gmail.com wrote in news:20051203182752.639$HH@newsreader.com:
> Vespasian <ves@ves.net> wrote:
>> Why does the following code correctly sets up a server
>>
> ...
>>
>> while the following does not i.e. it dies at the die statement,
>
> I'm guessing that the reason that it dies at the die statement would
> have be reflected in the contents of $! at the die statement. Why
> have you concealed this from us?
Take this with a grain of salt, but, IIRC correctly, $@ tends to be more
informative in IO::Socket related errors.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Sun, 04 Dec 2005 02:17:50 GMT
From: Vespasian <ves@ves.net>
Subject: Re: IO::Socket help
Message-Id: <8ek4p1dcnhoh1kon5m0d0e36oemkhhdr9a@4ax.com>
Error reported: unknown error
On Sat, 03 Dec 2005 23:43:26 GMT, "A. Sinan Unur"
<1usa@llenroc.ude.invalid> wrote:
>xhoster@gmail.com wrote in news:20051203182752.639$HH@newsreader.com:
>
>> Vespasian <ves@ves.net> wrote:
>>> Why does the following code correctly sets up a server
>>>
>> ...
>>>
>>> while the following does not i.e. it dies at the die statement,
>>
>> I'm guessing that the reason that it dies at the die statement would
>> have be reflected in the contents of $! at the die statement. Why
>> have you concealed this from us?
>
>Take this with a grain of salt, but, IIRC correctly, $@ tends to be more
>informative in IO::Socket related errors.
>
>Sinan
------------------------------
Date: Sat, 03 Dec 2005 14:26:16 -0500
From: John Smith <noone@nowhere.net>
Subject: migrate data tables
Message-Id: <2KydnRTtK8ywbAzenZ2dnUVZ_sSdnZ2d@comcast.com>
I have data in a Foxpro DBF table. Is there a quick, simple way in Perl
to copy this table into a SQLite table? I know how to do it manually
using DBI, but I'm looking for a package that does it all automatically.
I do not mind if the data types are not mapped exactly right. Could
SNOPS do it?
The reason I need to do this is because I need to generate some reports
from the Foxpro database. However, I'm unfamiliar with Foxpro SQL, the
Foxpro ODBC driver has very limited functionality, and the data is
read-only. So it would be easier if I imported the data into a more
advanced database and worked with it from there. I'm using Perl on
Windows XP.
------------------------------
Date: Sat, 3 Dec 2005 17:54:40 -0500
From: William <wh2leung@student.cs.uwaterloo.ca>
Subject: No Print output
Message-Id: <Pine.GSO.4.58.0512031749430.13065@cpu02.student.cs.uwaterloo.ca>
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;
------------------------------
Date: Sun, 04 Dec 2005 00:05:54 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: No Print output
Message-Id: <3vemmkF14lnh1U1@individual.net>
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/clpmisc/clpmisc_guidelines.html
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sat, 03 Dec 2005 18:11:36 -0500
From: Sherm Pendley <sherm@dot-app.org>
Subject: Re: No Print output
Message-Id: <m2iru5zsgn.fsf@Sherm-Pendleys-Computer.local>
William <wh2leung@student.cs.uwaterloo.ca> 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
------------------------------
Date: Sat, 3 Dec 2005 19:26:10 -0500
From: William <wh2leung@student.cs.uwaterloo.ca>
Subject: Re: No Print output
Message-Id: <Pine.GSO.4.58.0512031919040.22929@cpu02.student.cs.uwaterloo.ca>
>> > 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 <wh2leung@student.cs.uwaterloo.ca> 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
>
------------------------------
Date: Sat, 03 Dec 2005 19:51:57 -0500
From: Sherm Pendley <sherm@dot-app.org>
Subject: Re: No Print output
Message-Id: <m2zmnh7kgi.fsf@Sherm-Pendleys-Computer.local>
William <wh2leung@student.cs.uwaterloo.ca> 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
------------------------------
Date: Sun, 4 Dec 2005 01:51:18 +0100
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: No Print output
Message-Id: <dmtid3.110.1@news.isolution.nl>
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."
------------------------------
Date: Sat, 3 Dec 2005 22:07:33 -0500
From: William <wh2leung@student.cs.uwaterloo.ca>
Subject: Re: No Print output
Message-Id: <Pine.GSO.4.58.0512032148320.22929@cpu02.student.cs.uwaterloo.ca>
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 <wh2leung@student.cs.uwaterloo.ca> 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
> >
>
------------------------------
Date: Sat, 3 Dec 2005 22:24:27 -0500
From: William <wh2leung@student.cs.uwaterloo.ca>
Subject: Re: No Print output
Message-Id: <Pine.GSO.4.58.0512032224050.22929@cpu02.student.cs.uwaterloo.ca>
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."
>
------------------------------
Date: Sat, 03 Dec 2005 22:58:08 -0500
From: Sherm Pendley <sherm@dot-app.org>
Subject: Re: No Print output
Message-Id: <m24q5pjyy7.fsf@Sherm-Pendleys-Computer.local>
William <wh2leung@student.cs.uwaterloo.ca> 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
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 8729
***************************************