[18311] in Perl-Users-Digest
Perl-Users Digest, Issue: 479 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Mar 13 14:06:19 2001
Date: Tue, 13 Mar 2001 11:05:42 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <984510340-v10-i479@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 13 Mar 2001 Volume: 10 Number: 479
Today's topics:
Re: "uninitiatlized value" errors? <jazrant@zsc.nrcan.zc.ca>
Re: "uninitiatlized value" errors? <jazrant@zsc.nrcan.zc.ca>
Re: "uninitiatlized value" errors? <jazrant@zsc.nrcan.zc.ca>
Re: "uninitiatlized value" errors? <jazrant@zsc.nrcan.zc.ca>
Re: "uninitiatlized value" errors? <mischief@velma.motion.net>
#-Comments that ruin compilation? <dpc3k@virginia.edu>
Re: #-Comments that ruin compilation? <tony_curtis32@yahoo.com>
Re: #-Comments that ruin compilation? <dpc3k@virginia.edu>
Re: #-Comments that ruin compilation? <dan@tuatha.sidhe.org>
Re: $ENV{'HTTP_REFERER'} <rworth5@home.com>
Re: $ENV{'HTTP_REFERER'} <mischief@velma.motion.net>
Re: Cant call subs nobull@mail.com
RE: CGI module and file upload <ydzhang@iastate.edu>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 13 Mar 2001 12:01:17 -0500
From: "John A. Grant" <jazrant@zsc.nrcan.zc.ca>
Subject: Re: "uninitiatlized value" errors?
Message-Id: <98ljul$5ps11@nrn2.NRCan.gc.ca>
"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:873dclys9i.fsf@limey.hpcc.uh.edu...
> >> On Sat, 10 Mar 2001 20:54:40 -0500,
> >> "John A. Grant" <jazrant@zsc.nrcan.zc.ca> said:
[...]
> If you want to pass undef over, you need to change the
> test to be
>
> if (defined $cc) ...
Ok, I will do that. Is passing "undef" and testing for
"defined" the common/best way to do it?
In C I would have:
somefunc("some string");
somefunc(NULL);
and
void somefunc(char *string)
{
if(string) ...
}
> csh is certainly odd :-) Try reading this:
Well, I never thought I'd be told to use Bourne instead of
csh in a Perl group. I don't really care what shell I use
because for me it's only a "command-line" I use to run
Perl to test. The Perl code is only CGI code for the web.
--
John A. Grant * I speak only for myself * (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here
------------------------------
Date: Tue, 13 Mar 2001 12:05:06 -0500
From: "John A. Grant" <jazrant@zsc.nrcan.zc.ca>
Subject: Re: "uninitiatlized value" errors?
Message-Id: <98lk5q$5ps12@nrn2.NRCan.gc.ca>
"Garry Williams" <garry@zvolve.com> wrote in message
news:vrLq6.92$by1.9212@eagle.america.net...
> On Sat, 10 Mar 2001 23:43:48 -0500, Tad McClellan <tadmc@augustmail.com>
wrote:
> >John A. Grant <jazrant@zsc.nrcan.zc.ca> wrote:
> >>"Tad McClellan" <tadmc@augustmail.com> wrote in message
[...]
> >> if($cc) ...
> >
> > if( defined $cc ) ...
>
> There's something else going on here. `if ($var)' is exempt from that
> warning. Actually, using a variable in boolian context exempts it:
>
> perlsyn:
>
> Declarations
> ...
> If you enable warnings, you'll be notified of an
> uninitialized value whenever you treat `undef' as a string
> or a number. Well, usually. Boolean ("don't-care")
> contexts and operators such as `++', `--', `+=', `-=', and
> `.=' are always exempt from such warnings.
>
> $ perl -wle '$x = undef;if ($x) {print "true"} else {print "false"}'
> false
> $
Well, after I agreed with Tad's "if(defined $cc)" suggestion,
I see you are disagreeing with with him and saying it is ok.
Both stances seem reasonable to me, but I don't know
enough about it. Who is right?
--
John A. Grant * I speak only for myself * (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here
------------------------------
Date: Tue, 13 Mar 2001 12:23:22 -0500
From: "John A. Grant" <jazrant@zsc.nrcan.zc.ca>
Subject: Re: "uninitiatlized value" errors?
Message-Id: <98ll81$5ps13@nrn2.NRCan.gc.ca>
"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrn9am0k4.kui.tadmc@tadmc26.august.net...
> John A. Grant <jazrant@zsc.nrcan.zc.ca> wrote:
> >"Tad McClellan" <tadmc@augustmail.com> wrote in message
> >news:slrn9ack2f.9vo.tadmc@tadmc26.august.net...
> >> John A. Grant <jazrant@zsc.nrcan.zc.ca> wrote:
> > [...]
[...]
> > #return filename part of pathname
> > sub FilenameFromPathname()
> ^^
> ^^
> There you have prototyped the function to take no arguments at all.
It's not a prototype. it's the function body. There is
no prototype. While we're on the subject, I don't mind saying
that Perl prototypes suck real bad, at least compared
to C++.
> > {
> > my ($pathname)=@_;
> ^^^^^^^^^
>
> There you access arguments.
> You should fix the prototype, or delete it.
It's not a prototype, at least not in the sense that I use
prototypes in C++.
> > my $filename=$pathname;
> There is the last we hear of $pathname. The variable is useless.
> Just put it directly into $filename if that is where you want it:
Good point. Thanks.
> my($filename) = @_;
> die "FilenameFromPathname() got called with the undefined value" unless
> defined $filename;
> > That raises another issue. I never know whether to refer
> > to function parameters as "@" or "$".
>
> The choice between @ and $ has nothing to do with subroutines or
> subroutine arguments.
>
> Use $ if you want "a single thing" (a scalar).
>
> Use @ if you want "several things" (a list).
>
> Arguments are *always* scalars.
>
> The scalars are contained in a list. The list, in turn, is contained
> in an array named @_.
I understand arrays and I understand scalars. I don't
understand the syntax of associating a list of names
with the array of values passed to the function. If there
are several arguments this makes sense to me:
my ($arg1,$arg2,$arg3)=@_;
but what do I do when there is only one argument? Do
I do this:
my ($filename)=@_;
my ($filename)=$_[0];
???
> > I still have this problem:
> > 1703: my $method=$ENV{'REQUEST_METHOD'};
> > 1704: if($method eq "POST"){
> > Use of uninitialized value in string eq at contact.cgi line 1704.
> > Use of uninitialized value in string eq at contact.cgi line 1704.
> >
> > Why do I get 2 errors?
> ^^^^^^
> You have _zero_ errors.
> You have 2 warnings there.
Yeah, yeah, yeah. My personal philosophy for programming in
any language is to treat warnings and errors alike. In almost
all cases, the compiler is much smarter than me.
[...]
> > This problem still remains:
> > my $MAGIC_NOHTML="!";
> > ...
> > 1639: if (substr($message,0,1) eq $MAGIC_NOHTML){ ...
> >
> > "Use of uninitialized value in string eq at contact.cgi line 1639.
>
>
> Somewhere, in the part represented by the ellipsis above, the
> value of $MAGIC_NOHTML was changed.
No, it didn't here's the complete code:
my $MAGIC_NOHTML="!";
my $html=1;
if (substr($message,0,1) eq $MAGIC_NOHTML){
$message=substr $message, 1;
$html=0;
}
> Try adding this at line number 1638.5:
> print "what the heck happen to the value of \$MAGIC_NOHTML\n" unless
> defined $MAGIC_NOHTML;
You're right. It printed the phrase, so it's not defined. Sigh. What
an incredibly powerful but dopey language to debug.
> >> >But 2>err doesn't work on my solaris box (also running perl 5.6)
> >> ^^^^^^^
> What is the underlining for? You make no further mention of the OS...
I didn't underline it. Tad underlined it in his reply. I was told
to use Bourne instead of csh.
--
John A. Grant * I speak only for myself * (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here
------------------------------
Date: Tue, 13 Mar 2001 12:27:15 -0500
From: "John A. Grant" <jazrant@zsc.nrcan.zc.ca>
Subject: Re: "uninitiatlized value" errors?
Message-Id: <98llfb$5tm15@nrn2.NRCan.gc.ca>
"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:87y9udxdbr.fsf@limey.hpcc.uh.edu...
>
> [ 2nd follow up because I thought we were on the brink of
> 2 different threads ]
> >> On Sat, 10 Mar 2001 20:54:40 -0500,
> >> "John A. Grant" <jazrant@zsc.nrcan.zc.ca> said:
>
> > I still have this problem: 1703: my
> > $method=$ENV{'REQUEST_METHOD'}; 1704: if($method eq
> > "POST"){ Use of uninitialized value in string eq at
> > contact.cgi line 1704. Use of uninitialized value in
> > string eq at contact.cgi line 1704.
> > Why do I get 2 errors?
>
> Not sure why 2 errors, but the non-literal value you are
> interrogating is $method. Apparently the request handed
> over no value for the environment variable REQUEST_METHOD.
It's a compile error, not a runtime error.
[...]
> You could insert some test "print"s before the
> conditionals to see where the undef occurs.
Good idea. I'll do that. I've found one already.
Perhaps I'm misunderstanding the scope of variables.
If I have this on the first line of the program:
$my HELLO="hello";
is that considered a global, visible to all functions below
it in the same module? That's what my $MAGIC_NOHTML
"constant" is supposed to be. I'm coming from a C++
background so I probably don't have this right.
--
John A. Grant * I speak only for myself * (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here
------------------------------
Date: Tue, 13 Mar 2001 18:04:51 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: "uninitiatlized value" errors?
Message-Id: <tasoa39ehn9534@corp.supernews.com>
John A. Grant <jazrant@zsc.nrcan.zc.ca> wrote:
> "Tad McClellan" <tadmc@augustmail.com> wrote in message
> news:slrn9am0k4.kui.tadmc@tadmc26.august.net...
>> John A. Grant <jazrant@zsc.nrcan.zc.ca> wrote:
>> >"Tad McClellan" <tadmc@augustmail.com> wrote in message
>> >news:slrn9ack2f.9vo.tadmc@tadmc26.august.net...
>> >> John A. Grant <jazrant@zsc.nrcan.zc.ca> wrote:
>> > [...]
> [...]
>> > #return filename part of pathname
>> > sub FilenameFromPathname()
>> ^^
>> ^^
>> There you have prototyped the function to take no arguments at all.
> It's not a prototype. it's the function body. There is
> no prototype. While we're on the subject, I don't mind saying
> that Perl prototypes suck real bad, at least compared
> to C++.
Nope. If it was the function body, it would be within
curlies. Prototypes take parens, and bodies take curlies.
>> > {
>> > my ($pathname)=@_;
>> ^^^^^^^^^
>>
>> There you access arguments.
>> You should fix the prototype, or delete it.
> It's not a prototype, at least not in the sense that I use
> prototypes in C++.
It is a prototype. See above. This isn't C++. C++ does use
parens for prototypes and curlies for bodies. What's your
argument again?
>> > my $filename=$pathname;
>> There is the last we hear of $pathname. The variable is useless.
>> Just put it directly into $filename if that is where you want it:
> Good point. Thanks.
>> my($filename) = @_;
>> die "FilenameFromPathname() got called with the undefined value" unless
>> defined $filename;
>> > That raises another issue. I never know whether to refer
>> > to function parameters as "@" or "$".
>>
>> The choice between @ and $ has nothing to do with subroutines or
>> subroutine arguments.
>>
>> Use $ if you want "a single thing" (a scalar).
>>
>> Use @ if you want "several things" (a list).
>>
>> Arguments are *always* scalars.
>>
>> The scalars are contained in a list. The list, in turn, is contained
>> in an array named @_.
> I understand arrays and I understand scalars. I don't
> understand the syntax of associating a list of names
> with the array of values passed to the function. If there
> are several arguments this makes sense to me:
> my ($arg1,$arg2,$arg3)=@_;
> but what do I do when there is only one argument? Do
> I do this:
> my ($filename)=@_;
> my ($filename)=$_[0];
> ???
Yes.
Or:
my $filename = shift;
my $filename = $_[0];
Chris
--
Christopher E. Stith
Programming is a tool. A tool is neither good nor evil. It is
the user who determines how it is used and to what ends.
------------------------------
Date: Tue, 13 Mar 2001 11:02:02 -0500
From: "Doug Coppage" <dpc3k@virginia.edu>
Subject: #-Comments that ruin compilation?
Message-Id: <98lg9q$3gr$1@murdoch.acc.Virginia.EDU>
Greetings,
I posted a message a few months ago asking if anyone had trouble with
#-comments that raised compiler errors. I was told to come back with a
concrete example. I just ran across one this morning.
The code listed below is in a file called "noname02.pl". If enough words are
loaded into the comment after the first line in the FOR loop, the compiler
eventually picks on the last token before the end-of-line. Compiler output
is listed below the code.
----------------------------------
$range = 7;
for ( $i = $range; $i > 0; $i-- )
{
@timepart = localtime( $^T - ( $i * 86400 )); # The last thing in this comment causes trouble
$date = sprintf( "%04d/%02d/%02d", $timepart[5]+1900, $timepart[4]+1, $timepart[3] );
$stdFilename = $date;
$stdFilename =~ s/\//_/g; # Replace strokes with underscores.
print "$i $date $stdFilename\n";
};
----------------------------------
>perl -v
This is perl, v5.6.0 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2000, Larry Wall
Binary build 620 provided by ActiveState Tool Corp. http://www.ActiveState.com
Built 18:31:05 Oct 31 2000
...[etc.]
----------------------------------
>perl -w noname02.pl
Can't call method "trouble" on an undefined value at noname02.pl line 6.
-------------------------------------
[I then deleted the word "trouble", saved, and recompiled.]
>perl -w noname02.pl
Can't locate object method "comment" via package "causes" at noname02.pl line 6.
---------------------------------------
[I then deleted a few words so that the comment read, "# The last thing", saved, and recompiled.]
>perl -w noname02.pl
7 2001/03/06 2001_03_06
6 2001/03/07 2001_03_07
5 2001/03/08 2001_03_08
4 2001/03/09 2001_03_09
3 2001/03/10 2001_03_10
2 2001/03/11 2001_03_11
1 2001/03/12 2001_03_12
Output as expected. Very interesting....
Any comments?
===========================================
Douglas P. Coppage
dpc3k@virginia.edu
tel (804) 982-4021
fax (804) 982-4030
Microcomputer Support Specialist
University of Virginia
ITC - Academic Computing for the Health Sciences
Box 800555, Health Sciences Center
Charlottesville, VA 22908
http://www.med.virginia.edu/achs
===========================================
------------------------------
Date: 13 Mar 2001 10:18:50 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: #-Comments that ruin compilation?
Message-Id: <878zm9tzf9.fsf@limey.hpcc.uh.edu>
>> On Tue, 13 Mar 2001 11:02:02 -0500,
>> "Doug Coppage" <dpc3k@virginia.edu> said:
> Greetings, I posted a message a few months ago asking if
> anyone had trouble with #-comments that raised compiler
> errors. I was told to come back with a concrete
> example. I just ran across one this morning.
$range = 7;
for ( $i = $range; $i > 0; $i-- )
{
... # The last thing in this comment causes trouble
I think it's your editor line-wrapping. If you insert a
newline after "causes", you get the error message you
showed:
Can't call method "trouble" on an undefined value
If there are 2 or more words from the comment on their own
line, you get the other "Can't locate object method"
message.
hth
t
--
Just reach into these holes. I use a carrot.
------------------------------
Date: Tue, 13 Mar 2001 12:11:19 -0500
From: "Doug Coppage" <dpc3k@virginia.edu>
Subject: Re: #-Comments that ruin compilation?
Message-Id: <98lkbn$5bg$1@murdoch.acc.Virginia.EDU>
Bingo! What I saw was NOT what I got. The editor had word wrap turned on,
but it would not show how it wrapped until the source file was closed and
opened again. Nasssssssty editor!
Next time I'll post to comp.perl.notreally.misc.
Thanks,
---Doug Coppage
"Tony Curtis" <tony_curtis32@yahoo.com> wrote in message
news:878zm9tzf9.fsf@limey.hpcc.uh.edu...
> >> On Tue, 13 Mar 2001 11:02:02 -0500,
> >> "Doug Coppage" <dpc3k@virginia.edu> said:
>
> > Greetings, I posted a message a few months ago asking if
> > anyone had trouble with #-comments that raised compiler
> > errors. I was told to come back with a concrete
> > example. I just ran across one this morning.
>
> $range = 7;
> for ( $i = $range; $i > 0; $i-- )
> {
> ... # The last thing in this comment causes trouble
>
> I think it's your editor line-wrapping. If you insert a
> newline after "causes", you get the error message you
> showed:
>
> Can't call method "trouble" on an undefined value
>
> If there are 2 or more words from the comment on their own
> line, you get the other "Can't locate object method"
> message.
------------------------------
Date: Tue, 13 Mar 2001 17:45:25 GMT
From: Dan Sugalski <dan@tuatha.sidhe.org>
Subject: Re: #-Comments that ruin compilation?
Message-Id: <V0tr6.30141$Ok4.2996135@news1.rdc1.ct.home.com>
Doug Coppage <dpc3k@virginia.edu> wrote:
> Greetings,
> I posted a message a few months ago asking if anyone had trouble with
> #-comments that raised compiler errors. I was told to come back with a
> concrete example. I just ran across one this morning.
> The code listed below is in a file called "noname02.pl". If enough words are
> loaded into the comment after the first line in the FOR loop, the compiler
> eventually picks on the last token before the end-of-line. Compiler output
> is listed below the code.
I just tried this and it worked out without a problem, and I added in a lot
more text in that troublesome comment. This was on the 623 build
of ActivePerl.
Are you sure it's not something simple, like your editor is automagically
word-wrapping for you on save?
Dan
------------------------------
Date: Tue, 13 Mar 2001 15:47:57 GMT
From: "Richard" <rworth5@home.com>
Subject: Re: $ENV{'HTTP_REFERER'}
Message-Id: <Nirr6.4229$rB2.372788@news1.rdc1.mb.home.com>
I found out what is happening. Instead of displaying HTTP_REFERER
it is displaying HTTP_WEFERER = KUYFKJHVSADLAIWQKJHSDKJBWHFTEKWYVD (not
exactly like this)
I have no idea why it is changing this around all of a sudden, since it
worked fine last week.
Richard
"Dave Brondsema" <brondsema@my-deja.com> wrote in message
news:Klir6.53629$W05.10787456@news1.rdc1.mi.home.com...
>
> "BUCK NAKED1" <dennis100@webtv.net> wrote in message
> news:17760-3AADA855-1@storefull-247.iap.bryant.webtv.net...
> > Hmmm... I have a script that prints $ENV{HTTP_REFERER} yet if I print
> > out %ENV, it doesn't list a HTTP_REFERER. --Dennis
> >
>
> I had some strange problems concerning %ENV. When I printed all its
values,
> some were not listed. But I could access those just like ones that were
> printed.
>
> Is the server running Microsoft? If so you may be interested to take a
look
> at a thread from a few months ago.
>
> Message 7 at
>
http://groups.google.com/groups?hl=en&lr=&safe=off&th=a7bfa47b7c6b5c05&ic=1&
> seekd=953607740
>
>
------------------------------
Date: Tue, 13 Mar 2001 17:01:50 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: $ENV{'HTTP_REFERER'}
Message-Id: <taskjuhc7nq3f9@corp.supernews.com>
Richard <rworth5@home.com> wrote:
> "Dave Brondsema" <brondsema@my-deja.com> wrote in message
> news:Klir6.53629$W05.10787456@news1.rdc1.mi.home.com...
>> I had some strange problems concerning %ENV. When I
>> printed all its values, some were not listed. But I
>> could access those just like ones that were printed.
In some cases, an environment variable doesn't quite exist
until it is accessed. Kind of like the old question, "If a
tree falls in the forest and no one hears it, did it make
a sound?"
> I found out what is happening. Instead of displaying
> HTTP_REFERER it is displaying
> HTTP_WEFERER = KUYFKJHVSADLAIWQKJHSDKJBWHFTEKWYVD (not
> exactly like this)
That's just weird. Check the browser and httpd installations.
> I have no idea why it is changing this around all of a
> sudden, since it worked fine last week.
That's just weird. I'd check the server.
Chris
--
Christopher E. Stith
Programming is a tool. A tool is neither good nor evil. It is
the user who determines how it is used and to what ends.
------------------------------
Date: 13 Mar 2001 18:44:49 +0000
From: nobull@mail.com
Subject: Re: Cant call subs
Message-Id: <u94rwx8q5a.fsf@wcl-l.bham.ac.uk>
"moneybyus" <webmaster@moneybyus.net> writes:
> Could someone please help me out on this and tell me what im doing
> wrong.
You are posing your program UU encoded.
You don't use strict.
You don't enable warnings.
You rolled your own implementation of the CGI API rather than using
the standard libraries.
You put a \ infront of an @ in a single quoted string.
You don't check return values from open().
You don't show us the exact error you are getting.
You did not cut-down you script to the minimal for that still produces
the effect in question before posting.
You open a file in overwrite mode when you clearly meant to open it in
append mode.
You are writing a spam/mailbomb-by-proxy tool with no logging and not
throtelling. Such tools are widely used by spammers to provide
"plausible deniability". Even if you do not intend to Spam and then
claim it was requested by third partys using this nobody will believe
you. They won't believe you because this is not a court of law and
reasonable doubt is not enough. If everyone knows that 99% of people
who make a specific claim are lying and prooving that they are lying
is very difficult then BCP is to place the burden of proof on the
person making the claim (guilty until proven innocent).
Without logging you can't provide proof of innocence.
Your ISP will either kick you off or become blacklisted.
Even if you do put logging/throtelling into your tool you will still
have to work hard to prove your innocence as many spammers now
construct fraudument log files to support their lies.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 13 Mar 2001 12:16:33 -0600
From: YD <ydzhang@iastate.edu>
Subject: RE: CGI module and file upload
Message-Id: <3AAE6401.BB6EDB98@iastate.edu>
I have changed the definitions for
$POST_MAX = 1024 * 100; # max 100K posts
$DISABLE_UPLOADS = 0; # allow uploads; 1=disallow uploads
in CGI.pm
the perl script print out the values for thw two variables, but the
filehandle is still empty,
Any futher suggestion? is there anything to do with my web server and
broswer?
Yuandan
#!/usr/bin/perl
use CGI qw/:standard/;
#use CGI::Carp 'fatalsToBrowser';
#$CGI::POST_MAX = 1024 * 100; # max 100K posts
#$CGI::DISABLE_UPLOADS = 0; # allow uploads; 1=disallow uploads
$query =new CGI;
print $query->header;
#print"Content-type:text/html\n\n";
$name = $query->param('name');
$email = $query->param('email');
$marker = $query->param('marker');
$chromosome = $query->param('chromosome');
$upfile = $query->param('upfile');
print $query->start_html(-title=>'Gneotype Submission for BY family',
-BGCOLOR=>'blue');
print $query->hr;
print $query->end_html;
print "$name\n<br>";
print "$email\n<br>";
print "$marker\n<br>";
print "$chromosome\n<br>";
print $query->hr;
print "$upfile\n";
#$upfile = "main::$upfile";
print "<BR> $upfile\n";
while (<$upfile>) {
print "$_<br>\n";
}
print $query->end_html;
print "$CGI::POST_MAX\n<br>";
print "$CGI::DISABLE_UPLOADS\n<br>";
exit 0;
Darhl Stultz wrote:
> When I was researching the file upload problem in the post ahead of
> yours I
> found this info that you might be able to use...
>
> There are two definitions in CGI.pm for $POST_MAX and $DISABLE_UPLOADS
> (in
> subroutine initialize_globals() ) You can reset them in your program
> thusly:
>
> $CGI::POST_MAX = 1024 * 100; # max 100K posts
> $CGI::DISABLE_UPLOADS = 0; # allow uploads; 1=disallow uploads
>
> dc
>
> YD wrote:
>
> > Hi,
> > a question regarding CGI.pm module.
> >
> > I try to upload a text file via web form and use CGI perl module to
> > parse the submission.
> > in web form, a entry set as :
> > <INPUT TYPE="file" NAME="upfile" enctype="multipart/form
> > -data">
> > or
> > <INPUT TYPE="file" NAME="upfile">
> >
> > In my cgi file, I use
> >
> > use CGI qw/:standard/;
> > $query =new CGI;
> > print $query->header;
> > #print"Content-type:text/html\n\n";
> >
> > $name = $query->param('name');
> > $email = $query->param('email');
> > $marker = $query->param('marker');
> > $upfile = $query->param('upfile');
> >
> > ....
> > The returned 'upfile' value is the file name and its path. However,
> when
> > I use this as file handle, it is empty.
> > tried this and did not print anything
> >
> > while (<$upfile>) {
> > print "## $_<br>\n";
> > }
> >
> > then, tried to manupilate the file handle by
> >
> > $upfile = "main::$upfile";
> >
> > the file handle is empty again.
> >
> > Can someone help me fix this?
> >
> > Thanks,
> > Yuandan
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
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: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 479
**************************************