[17060] in Perl-Users-Digest
Perl-Users Digest, Issue: 4472 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Sep 29 18:10:38 2000
Date: Fri, 29 Sep 2000 15:10:23 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <970265423-v9-i4472@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Fri, 29 Sep 2000 Volume: 9 Number: 4472
Today's topics:
Re: How to get length of scalar? <mcarruth@talk21.com>
Re: How to get length of scalar? <mcarruth@talk21.com>
Re: How to get length of scalar? <mcarruth@talk21.com>
Re: How to get length of scalar? <zaphod@psnw.com>
Re: how to read dir info ? <bart.lateur@skynet.be>
Huh? <gene@allsysinc.com>
Re: Huh? <jeff@vpservices.com>
Re: Huh? (Craig Berry)
Re: Just Another Perl Hacker (Craig Berry)
Re: Just Another Perl Hacker <russ_jones@rac.ray.com>
Re: Just Another Perl Hacker <tony_curtis32@yahoo.com>
Newbie can't handle the "true"th... explanation desire (Jon S.)
Re: Newbie can't handle the "true"th... explanation de (Craig Berry)
Re: Newbie can't handle the "true"th... explanation de <tim@ipac.caltech.edu>
Re: Newbie can't handle the "true"th... explanation de <lr@hpl.hp.com>
Re: Newbie can't handle the "true"th... explanation de <lr@hpl.hp.com>
Re: newbie question (Jon S.)
outputting to a file <celliot@tartarus.uwa.edu.au>
Re: outputting to a file <jeff@vpservices.com>
Re: outputting to a file <lr@hpl.hp.com>
Re: Perl & CGI.pm - Textfield passing variable doesnt w <bmb@ginger.libs.uga.edu>
Re: Perl & CGI.pm - Textfield passing variable doesnt w ebohlman@omsdev.com
Re: Perl & CGI.pm - Textfield passing variable doesnt w lim_k@my-deja.com
Re: Perl & CGI.pm - Textfield passing variable doesnt w <godzilla@stomp.stomp.tokyo>
Re: Perl & CGI.pm - Textfield passing variable doesnt w <hartleh1@westat.com>
Perl Engineers / Programmers mgalvin6792@my-deja.com
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 29 Sep 2000 22:03:06 +0100
From: "Mark Carruth" <mcarruth@talk21.com>
Subject: Re: How to get length of scalar?
Message-Id: <8r303h$20s$1@uranium.btinternet.com>
OK, just to round off these little arguments.
1) Uri, my wife cannot call me in idiot as I am 13 and have no wife :P
2) Fair enough, I am lazy for not posting Plain Text each time.
3) I have no "responsibility" to take for my actions, it is not like I have
commited a crime.
4) And as for the HTML argument, I don't write my WEB/HTML documents in
anything other than HTML or PHP which is HTML with embedded code.
--
-----------------------------------------------
Mark Carruth
mcarruth@talk21.com
"Mark Carruth" <mcarruth@talk21.com> wrote in message
news:8qvu41$sb9$1@neptunium.btinternet.com...
As a large proportion of the Internet is centered around HTML, I think it is
a good idea that whatever programme anyone writes to talk to an NNTP server
has some form of HTML parser built in.
And, yes URI, my message DID contain some information but as you people
don't seem to care about what I have to say, I shan't bother helping people
any more.
--
-----------------------------------------------
Mark Carruth
mcarruth@talk21.com
"Mark Carruth" <mcarruth@talk21.com> wrote in message
news:8qthfc$26d$1@uranium.btinternet.com...
Why is it you people have such a problem with HTML. Either, get a decent
mail client for Windows, or if you use Unix and you are such a bloody genius
at it to go criticising other people, make yourself a f*c*i*g HTML parser
that will work on Windows.
You will notice that this message is in plain text for you "Challenged"
people.
--
-----------------------------------------------
Mark Carruth
mcarruth@talk21.com
"Uri Guttman" <uri@sysarch.com> wrote in message
news:x7u2b28o07.fsf@home.sysarch.com...
did you actually have anything to say? or was it lost in the sea of html
crap?
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Fri, 29 Sep 2000 22:04:41 +0100
From: "Mark Carruth" <mcarruth@talk21.com>
Subject: Re: How to get length of scalar?
Message-Id: <8r306g$hpn$1@neptunium.btinternet.com>
Well bully for you. I guess you should learn russian then.
--
-----------------------------------------------
Mark Carruth
mcarruth@talk21.com
"Henry Hartley" <hartleh1@westat.com> wrote in message
news:39D4BB30.B4FA639B@westat.com...
Mark Carruth wrote:
>
> The reason I post HTML is that I use Outlook Express to look at these
> newsgroups, and I also use Outlook Express to read my mail.
>
> As I send all my emails (which are part of my LIFE Uri) using HTML, the
> programme sends all my posts in HTML. I never have people moaning about
HTML
> in Email so I don't know why I should change.
The reason I speak in English is that my brain works in that language.
I make all my phone calls (which are part of my LIFE) using English.
The other day, I called someone in Kazakhstan and the rude person on the
other end wouldn't help me. He told me (IN RUSSIAN!) that I would have
to speak Russian if I wanted him to talk to me. Actually, he said that
if I spoke Kazakh, that would be fine, too, but that wasn't much help.
I don't know where he got an attitude like this but it's really
annoying. Why should I use his standard? After all, English is the
language of the phone system. At least, I've never had any other people
I talk to complaining that I speak English.
Anyway, I started answering his questions before he asked them. It just
seemed the right thing to do. He hung up on me and now he won't take my
calls! All he said was *plonk*. I wonder what he meant by that.
--
Henry Hartley
------------------------------
Date: Fri, 29 Sep 2000 22:09:59 +0100
From: "Mark Carruth" <mcarruth@talk21.com>
Subject: Re: How to get length of scalar?
Message-Id: <8r30gg$34k$1@uranium.btinternet.com>
I would just like to add, that to round off this argument, if you people can
leave it at this, is that I didn't even post this reply to any of you
people, so I don't really think you have the right to start criticising,
then the information isn't directed at you.
A voice version of this would be "eavestropping" or listening to other
peoples conversations which I consider to be down right rude, and therefore
you people must all be down right rude.
Hope you all have a wonderful day,
--
-----------------------------------------------
Mark Carruth
mcarruth@talk21.com
"Mark Carruth" <mcarruth@talk21.com> wrote in message
news:8qvur2$4il$1@uranium.btinternet.com...
The reason I post HTML is that I use Outlook Express to look at these
newsgroups, and I also use Outlook Express to read my mail.
As I send all my emails (which are part of my LIFE Uri) using HTML, the
programme sends all my posts in HTML. I never have people moaning about HTML
in Email so I don't know why I should change.
--
-----------------------------------------------
Mark Carruth
mcarruth@talk21.com
"Mark Carruth" <mcarruth@talk21.com> wrote in message
news:8qthfc$26d$1@uranium.btinternet.com...
Why is it you people have such a problem with HTML. Either, get a decent
mail client for Windows, or if you use Unix and you are such a bloody genius
at it to go criticising other people, make yourself a f*c*i*g HTML parser
that will work on Windows.
You will notice that this message is in plain text for you "Challenged"
people.
--
-----------------------------------------------
Mark Carruth
mcarruth@talk21.com
"Uri Guttman" <uri@sysarch.com> wrote in message
news:x7u2b28o07.fsf@home.sysarch.com...
did you actually have anything to say? or was it lost in the sea of html
crap?
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Fri, 29 Sep 2000 14:31:38 -0700
From: Zaphod <zaphod@psnw.com>
Subject: Re: How to get length of scalar?
Message-Id: <39D50A3A.273D35B0@psnw.com>
Mark Carruth wrote:
>
> I would just like to add, that to round off this argument, if you people can
> leave it at this, is that I didn't even post this reply to any of you
> people, so I don't really think you have the right to start criticising,
> then the information isn't directed at you.
>
> A voice version of this would be "eavestropping" or listening to other
> peoples conversations which I consider to be down right rude, and therefore
> you people must all be down right rude.
>
> Hope you all have a wonderful day,
>
Could it be that you really don't understand the concept of a news
"group"?
--
Zaphod
Technical Director
------------------------------------------------------------------------
TruckLoad2000 A Service of Acquisitions Services, LLC.
------------------------------------------------------------------------
Support: (559) 304-0882 2680 N. Marks suit 106
Direct: (559) 275-0493 Fresno, CA 93722
Toll Free: (866) 275-0493 http://www.TruckLoad2000.com
Fax: (559) 275-0529 email: zaphod@TruckLoad2000.com
========================================================================
========================================================================
------------------------------
Date: Fri, 29 Sep 2000 19:03:00 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: how to read dir info ?
Message-Id: <hnp9tsc7ll1m4of302fl1uvpjceiceqddl@4ax.com>
qwerty wrote:
>thanks, but it does not work, it actually shows ALL the files
>and i only want is the directory names.
perldoc -f grep.
@dirs = grep { -d } @everything;
If your filesnames are bare filenames, like readdir() returns, make sure
your current directory is set to that directory, or the files won't be
found. Or you can prepend the directory path to your files for the test.
@dirs = grep { -d "$path/$_" } @everything;
--
Bart.
------------------------------
Date: Fri, 29 Sep 2000 20:36:01 GMT
From: "Gene" <gene@allsysinc.com>
Subject: Huh?
Message-Id: <R27B5.1267$Sa.80982@news.flash.net>
What's all that about?
------------------------------
Date: Fri, 29 Sep 2000 13:46:10 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: Huh?
Message-Id: <39D4FF92.78F8B5F4@vpservices.com>
Gene wrote:
>
> What's all that about?
It is about the fact that this is an international newsgroup and
therefore English is not the only language permitted.
--
Jeff
------------------------------
Date: Fri, 29 Sep 2000 20:53:45 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Huh?
Message-Id: <sta0apt24tg466@corp.supernews.com>
Gene (gene@allsysinc.com) wrote:
: What's all that about?
Nothing, nothing, move along, nothing to see here, show's over, move
along, folks...
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Quidquid latine dictum sit, altum viditur."
|
------------------------------
Date: Fri, 29 Sep 2000 19:10:14 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Just Another Perl Hacker
Message-Id: <st9q8m2nm3b18@corp.supernews.com>
Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote:
: Randal L. Schwartz <merlyn@stonehenge.com> wrote in comp.lang.perl.misc:
: >>>>>> "Graham" == Graham Wood <graham.wood@iona.com> writes:
: >
: >Graham> It obviously isn't infinite or you wouldn't have finished reading it.
: >
: >Nor would I have finished writing it. :)
:
: So have you?
Yes, but the margin of this newsgroup is alas too small to contain it.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Quidquid latine dictum sit, altum viditur."
|
------------------------------
Date: Fri, 29 Sep 2000 14:32:57 -0500
From: Russ Jones <russ_jones@rac.ray.com>
Subject: Re: Just Another Perl Hacker
Message-Id: <39D4EE69.9EA5C621@rac.ray.com>
Craig Berry wrote:
>
>
> Yes, but the margin of this newsgroup is alas too small to contain it.
>
I think de Fermat was an evil trickster. Much like some others I could
name.
--
Russ Jones - HP OpenView IT/Operatons support
Raytheon Aircraft Company, Wichita KS
russ_jones@rac.ray.com 316-676-0747
Quae narravi, nullo modo negabo. - Catullus
------------------------------
Date: 29 Sep 2000 15:37:27 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Just Another Perl Hacker
Message-Id: <87vgvflyt4.fsf@limey.hpcc.uh.edu>
>> On Fri, 29 Sep 2000 14:32:57 -0500,
>> Russ Jones <russ_jones@rac.ray.com> said:
> Craig Berry wrote:
>>
>> Yes, but the margin of this newsgroup is alas too small
>> to contain it.
>>
> I think de Fermat was an evil trickster.
He should 'a used a better fermatter.
--
Namaste!
And an "oogabooga" to you too!
-- Homer Simpson
------------------------------
Date: Fri, 29 Sep 2000 20:43:20 GMT
From: jonceramic@nospammiesno.earthlink.net (Jon S.)
Subject: Newbie can't handle the "true"th... explanation desired
Message-Id: <39d4fc12.26424851@news.earthlink.net>
Hi,
I know this must seem dumb, but I'm trying to figure out the proper
way to set a scalar as a boolean "true" or "false".
Larry R. and others helped me before with a definition of a variable
using a condition that was either true or false, but now I've found a
spot where I just want to seed something a "true" value for later use.
I've resorted to using
$itstrue = 1;
(I also contemplated just giving it the string "true".)
But I keep wondering if there's a better way, more exact way. (Like,
is there some standard expression that comes up true which everyone
uses?)
Similarly, just what gets put into a variable when you set it as true
or false?
TIA,
Jon
------------------------------
Date: Fri, 29 Sep 2000 21:02:04 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Newbie can't handle the "true"th... explanation desired
Message-Id: <sta0qcnt8ha43d@corp.supernews.com>
Jon S. (jonceramic@nospammiesno.earthlink.net) wrote:
: I know this must seem dumb, but I'm trying to figure out the proper
: way to set a scalar as a boolean "true" or "false".
Not dumb at all, and you can choose a convention which works for you.
Personally, I prefer 1 and 0, since this mimics the behavior in C (a
language I've used much longer than Perl).
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Quidquid latine dictum sit, altum viditur."
|
------------------------------
Date: Fri, 29 Sep 2000 14:07:21 -0700
From: Tim Conrow <tim@ipac.caltech.edu>
Subject: Re: Newbie can't handle the "true"th... explanation desired
Message-Id: <39D50489.F5BD35CD@ipac.caltech.edu>
"Jon S." wrote:
> I know this must seem dumb, but I'm trying to figure out the proper
> way to set a scalar as a boolean "true" or "false".
>
> I've resorted to using
> $itstrue = 1;
That's fine.
>
> (I also contemplated just giving it the string "true".)
That's fine too.
>
> But I keep wondering if there's a better way, more exact way. (Like,
> is there some standard expression that comes up true which everyone
> uses?)
'1' is robably the most common, but if you want to ensure maximum readability
and want to increase the cool factor of your program, you could do
use constant TRUE=>1;
>
> Similarly, just what gets put into a variable when you set it as true
> or false?
1 and undef.
perl -wle 'print 1==1'
1
--
-- Tim Conrow tim@ipac.caltech.edu |
------------------------------
Date: Fri, 29 Sep 2000 14:06:08 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Newbie can't handle the "true"th... explanation desired
Message-Id: <MPG.143ea41f212df92698addf@nntp.hpl.hp.com>
In article <39d4fc12.26424851@news.earthlink.net> on Fri, 29 Sep 2000
20:43:20 GMT, Jon S. <jonceramic@nospammiesno.earthlink.net> says...
> Hi,
Here in California, "Yo, dude!"
> I know this must seem dumb, but I'm trying to figure out the proper
> way to set a scalar as a boolean "true" or "false".
Any way that works is 'proper'.
> Larry R. and others helped me before with a definition of a variable
> using a condition that was either true or false, but now I've found a
> spot where I just want to seed something a "true" value for later use.
>
> I've resorted to using
> $itstrue = 1;
>
> (I also contemplated just giving it the string "true".)
More characters to type. You could even use 'false', to drive the
maintainers crazy.
> But I keep wondering if there's a better way, more exact way. (Like,
> is there some standard expression that comes up true which everyone
> uses?)
1 (though some people prefer 42)
Some people just autoincrement an unassigned value, which works but is
uninformative, IMO.
> Similarly, just what gets put into a variable when you set it as true
> or false?
The value of whatever you assign.
Though you didn't ask explicitly, the only 'false' values are:
an arithmetic expression that evaluates to 0
the string '0'
the undefined value (undef, or not assigning anything)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 29 Sep 2000 14:33:20 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Newbie can't handle the "true"th... explanation desired
Message-Id: <MPG.143eaa7993558fcc98ade0@nntp.hpl.hp.com>
In article <39D50489.F5BD35CD@ipac.caltech.edu> on Fri, 29 Sep 2000
14:07:21 -0700, Tim Conrow <tim@ipac.caltech.edu> says...
> "Jon S." wrote:
...
> > Similarly, just what gets put into a variable when you set it as true
> > or false?
>
> 1 and undef.
No, it is 1 and the null string "", which is converted silently to 0 in
arithmetic context.
> perl -wle 'print 1==1'
> 1
perl -wle 'print 1==0'
perl -wle 'print 0 + (1==0)'
0
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 29 Sep 2000 19:23:27 GMT
From: jonceramic@nospammiesno.earthlink.net (Jon S.)
Subject: Re: newbie question
Message-Id: <39d4e741.21094253@news.earthlink.net>
On Thu, 28 Sep 2000 18:03:37 -0000, cberry@cinenet.net (Craig Berry)
wrote:
>Jon S. (jonceramic@nospammiesno.earthlink.net) wrote:
>: Is there an easy way to check if a scalar is a number?
>
>Yes, for various types of "number" (integer, floating point, with or
>without exponential notation, and so forth). The FAQ covers this
>exhaustively.
I see it does. Down at the very bottom! ;)
>: But, how would I check if I wasn't using that module? I couldn't find
>: it in any of the FAQ's or my books... just lots of references to the
>: fact that Perl doesn't care if it's a number or a string.
>
>Watch your phrasing at the end, there; in Perl, 'string' is a superset of
>'number'. :)
Gotcha. Understood.
>See perlfaq4, "How do I determine whether a scalar is a
>number/whole/integer/float?" By the way, I found this in one try using
>
> perldoc -q 'is a number'
Thanks Craig (and nobull too!)... I never made it to that point. I
jumped to the section on regexp's and got completely lost trying to
roll my own (which didn't work for some reason probably related to my
eternal newbieness). Then I found the DBI/DBD function and didn't go
any farther. Learning Perl and Perl in a Nutshell never pointed me
close enough.
FYI, I also just found that the data types documentation has the same
information listed in faq4.
Jon
------------------------------
Date: Sat, 30 Sep 2000 05:30:35 +0800
From: "Cameron Elliott" <celliot@tartarus.uwa.edu.au>
Subject: outputting to a file
Message-Id: <39d50a35$0$22264@echo-01.iinet.net.au>
Is there a way to output to a file at a certain line?
I know I can read in the whole file , manipulate it, then output it again
but that is inefficient.
Is there a way to do it quickly?
ie..
[lots of text]
......insert line of text here......
[lots of text]
thanks
------------------------------
Date: Fri, 29 Sep 2000 14:50:40 -0700
From: Jeff Zucker <jeff@vpservices.com>
Subject: Re: outputting to a file
Message-Id: <39D50EB0.AD4EF6EE@vpservices.com>
Cameron Elliott wrote:
>
> Is there a way to output to a file at a certain line?
> I know I can read in the whole file , manipulate it, then output it again
> but that is inefficient.
> Is there a way to do it quickly?
>
> ie..
>
> [lots of text]
> ......insert line of text here......
> [lots of text]
>
> thanks
Perlfaq5 includes your answer in the section titled
"How do I change one line in a file
/delete a line in a file
/insert a line in the middle of a file
/append to the beginning of a file?"
The short answer is: can't be done unless "lots of text" is in fixed
width records such that you know exactly where in the file (in terms of
bytes) you want to do your insert.
--
Jeff
------------------------------
Date: Fri, 29 Sep 2000 14:53:12 -0700
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: outputting to a file
Message-Id: <MPG.143eaf1f63fe658d98ade2@nntp.hpl.hp.com>
In article <39d50a35$0$22264@echo-01.iinet.net.au> on Sat, 30 Sep 2000
05:30:35 +0800, Cameron Elliott <celliot@tartarus.uwa.edu.au> says...
> Is there a way to output to a file at a certain line?
> I know I can read in the whole file , manipulate it, then output it again
> but that is inefficient.
> Is there a way to do it quickly?
>
> ie..
>
> [lots of text]
> ......insert line of text here......
> [lots of text]
My, how Frequently this Question is Asked. Surely someone has thought
of an answer. Oh, yes, here it is, in perlfaq5 -- Files and Formats:
How do I change one line in a file/delete a line in a file/insert a line
in the middle of a file/append to the beginning of a file?
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Fri, 29 Sep 2000 14:25:20 -0400
From: Brad Baxter <bmb@ginger.libs.uga.edu>
Subject: Re: Perl & CGI.pm - Textfield passing variable doesnt work
Message-Id: <Pine.A41.4.21.0009291418260.10690-100000@ginger.libs.uga.edu>
On Fri, 29 Sep 2000 lim_k@my-deja.com wrote:
> I have a HTML form with a textfield and submit button. The text
> entered is passed as a variable $id, but the issue I'm having is that
> $id is not being passed.
>
> $var = new CGI;
>
> print $var->start_form, "\n",
> $var->textfield( -name=>'id', -default=>''),
> $var->submit,
> $var->end_form, "\n";
>
> $id = $var->param('id');
>
> print "$id\n";
>
> When running this print statement, the error I'm having is use of
> unitialized value at line (where this print statement is located at).
>
> I have a created another script before this, which uses the exact same
> code, except for the $var being different and it works fine. Any
> suggestions/ideas is greatly appreciated.
Hmmm. It probably means that $id is unitialized, meaning that
$var->param('id') returned undef, meaning that there was no
"id=stuff" among the parameters.
1 #!/usr/local/bin/perl -w
2 use strict;
3 use CGI;
4
5 my $var = new CGI;
6
7 print $var->start_form, "\n",
8 $var->textfield( -name=>'id', -default=>''),
9 $var->submit,
10 $var->end_form, "\n";
11
12 my $id = $var->param('id');
13
14 print "$id\n";
FIRST TIME:
(offline mode: enter name=value pairs on standard input)
"name=value"
<FORM METHOD="POST" ENCTYPE="application/x-www-form-urlencoded">
<INPUT TYPE="text" NAME="id" ><INPUT TYPE="submit" NAME=".submit"></FORM>
Use of uninitialized value at ./qt line 14, <STDIN> chunk 1.
SECOND TIME:
(offline mode: enter name=value pairs on standard input)
"id=stuff"
<FORM METHOD="POST" ENCTYPE="application/x-www-form-urlencoded">
<INPUT TYPE="text" NAME="id" VALUE="stuff"><INPUT
TYPE="submit" NAME=".submit"></FORM>
stuff
Solutions:
o use strict; (just because)
o check whether or not $id is undef before printing it
Brad
------------------------------
Date: 29 Sep 2000 18:59:57 GMT
From: ebohlman@omsdev.com
Subject: Re: Perl & CGI.pm - Textfield passing variable doesnt work
Message-Id: <8r2ord$1n8$4@news.enteract.com>
lim_k@my-deja.com wrote:
> I have a HTML form with a textfield and submit button. The text
> entered is passed as a variable $id, but the issue I'm having is that
> $id is not being passed.
> $var = new CGI;
> print $var->start_form, "\n",
> $var->textfield( -name=>'id', -default=>''),
> $var->submit,
> $var->end_form, "\n";
> $id = $var->param('id');
> print "$id\n";
> When running this print statement, the error I'm having is use of
> unitialized value at line (where this print statement is located at).
When you're using the same script to both generate a form and receive
input from the form (a good idea in principle, by the way), you have to
make sure your code distinguishes between the case where it's being called
to generate the form for the first time and thus doesn't have any input
yet and the case where it's being called in response to a submission. In
your script, $id won't have been set to anything in the first case, and
therefore you'll get a warning message.
The usual way to distinguish between the two cases is to call param() with
no arguments; this will return a false value if there's no input and a
true value if there is input.
------------------------------
Date: Fri, 29 Sep 2000 19:55:28 GMT
From: lim_k@my-deja.com
Subject: Re: Perl & CGI.pm - Textfield passing variable doesnt work
Message-Id: <8r2s3c$duq$1@nnrp1.deja.com>
In article <Pine.A41.4.21.0009291418260.10690-
100000@ginger.libs.uga.edu>,
Brad Baxter <bmb@ginger.libs.uga.edu> wrote:
> On Fri, 29 Sep 2000 lim_k@my-deja.com wrote:
>
> > I have a HTML form with a textfield and submit button. The text
> > entered is passed as a variable $id, but the issue I'm having is
that
> > $id is not being passed.
> >
> > $var = new CGI;
> >
> > print $var->start_form, "\n",
> > $var->textfield( -name=>'id', -default=>''),
> > $var->submit,
> > $var->end_form, "\n";
> >
> > $id = $var->param('id');
> >
> > print "$id\n";
> >
> > When running this print statement, the error I'm having is use of
> > unitialized value at line (where this print statement is located
at).
> >
> > I have a created another script before this, which uses the exact
same
> > code, except for the $var being different and it works fine. Any
> > suggestions/ideas is greatly appreciated.
>
> Hmmm. It probably means that $id is unitialized, meaning that
> $var->param('id') returned undef, meaning that there was no
> "id=stuff" among the parameters.
>
> 1 #!/usr/local/bin/perl -w
> 2 use strict;
> 3 use CGI;
> 4
> 5 my $var = new CGI;
> 6
> 7 print $var->start_form, "\n",
> 8 $var->textfield( -name=>'id', -default=>''),
> 9 $var->submit,
> 10 $var->end_form, "\n";
> 11
> 12 my $id = $var->param('id');
> 13
> 14 print "$id\n";
>
> FIRST TIME:
>
> (offline mode: enter name=value pairs on standard input)
> "name=value"
> <FORM METHOD="POST" ENCTYPE="application/x-www-form-urlencoded">
>
> <INPUT TYPE="text" NAME="id" ><INPUT TYPE="submit"
NAME=".submit"></FORM>
> Use of uninitialized value at ./qt line 14, <STDIN> chunk 1.
>
> SECOND TIME:
>
> (offline mode: enter name=value pairs on standard input)
> "id=stuff"
> <FORM METHOD="POST" ENCTYPE="application/x-www-form-urlencoded">
>
> <INPUT TYPE="text" NAME="id" VALUE="stuff"><INPUT
> TYPE="submit" NAME=".submit"></FORM>
> stuff
>
> Solutions:
>
> o use strict; (just because)
> o check whether or not $id is undef before printing it
>
> Brad
tested with id=yaddayaddayadda at prompt and it worked, but still $var-
>param('id') will not pass with just yaddayaddayadda. The piece of
code in this posting was a stripped down version of all code of what
the script will be doing. What the code I placed in there was the part
dealing with creating and passing $id. Thanks for the assistance, any
other suggestions?
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Fri, 29 Sep 2000 13:57:31 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Perl & CGI.pm - Textfield passing variable doesnt work
Message-Id: <39D5023B.E49EE22E@stomp.stomp.tokyo>
lim_k@my-deja.com wrote:
> Brad Baxter wrote:
> > lim_k wrote:
(snipped)
> > <INPUT TYPE="text" NAME="id" ><INPUT TYPE="submit"
> > NAME=".submit"></FORM>
> > Use of uninitialized value at ./qt line 14, <STDIN> chunk 1.
> ... Thanks for the assistance, any other suggestions?
Remove this period from ".submit" and add VALUE="A Button" ?
Godzilla!
------------------------------
Date: Fri, 29 Sep 2000 17:38:42 -0400
From: Henry Hartley <hartleh1@westat.com>
Subject: Re: Perl & CGI.pm - Textfield passing variable doesnt work
Message-Id: <39D50BE2.8C2EB8C1@westat.com>
ebohlman@omsdev.com wrote:
>
> lim_k@my-deja.com wrote:
> > I have a HTML form with a textfield and submit button. The text
> > entered is passed as a variable $id, but the issue I'm having is that
> > $id is not being passed.
>
> When you're using the same script to both generate a form and receive
> input from the form (a good idea in principle, by the way), you have to
> make sure your code distinguishes between the case where it's being called
> to generate the form for the first time and thus doesn't have any input
> yet and the case where it's being called in response to a submission. In
> your script, $id won't have been set to anything in the first case, and
> therefore you'll get a warning message.
And be careful not to confuse the $id with the $ego. :)
--
Henry Hartley
------------------------------
Date: Fri, 29 Sep 2000 18:07:35 GMT
From: mgalvin6792@my-deja.com
Subject: Perl Engineers / Programmers
Message-Id: <8r2lot$7rh$1@nnrp1.deja.com>
We've got an exciting career for you that is
faster than the speed of sound! After all, who
knows more about great sound than MP3.com? Here,
you'll find as many employee benefits at MP3.com
as there are different types of music. Catered
lunches, an on-site fitness center, flexible work
schedules, stock option plans, on-site massage
therapy, a 401k program, and of course, great
pay… the list goes on and on!
We're the global leader in digital music
delivery, with a technical infrastructure that is
changing the way the world listens to music. Link-
in to our community of world-class technologists
whose work is “changing the infrastructure of the
internet.”
MP3.com is seeking a Software Engineer that will
be involved with scaling our existing
infrastructure to meet future demands of traffic
and performance. As well as adding new features
to our serving infrastructure (e.g., serving
ID3v2 tags with our MP3's). Writing, enhancing,
and maintaining Apache modules as necessary.
Determining feasibility and implementing (as
appropriate) cacheing infrastructure for our
publishing servers.
We are seeking an engineer with 5+ years of
experience with Unix environments (Linux) and
Perl programming. 3+ years of experience with web
server administration (Apache).
jobs@mp3.com
MP3.com
San Diego, California
http://www.mp3.com/jobs
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
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 V9 Issue 4472
**************************************