[22461] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 4682 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 7 18:12:11 2003

Date: Fri, 7 Mar 2003 15:10:12 -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           Fri, 7 Mar 2003     Volume: 10 Number: 4682

Today's topics:
    Re: Lightweight CGI module? <tore@aursand.no>
    Re: Lightweight CGI module? <tore@aursand.no>
    Re: Lightweight CGI module? <tore@aursand.no>
    Re: Obfuscated Perl Challenge <ericm-NOSPAM-@vertical.com>
    Re: Obfuscated Perl Challenge <goldbb2@earthlink.net>
    Re: Obfuscated Perl Challenge <abigail@abigail.nl>
    Re: perlcc error (cl and link) (Krusty)
        Prefix matching for filenames? (jtd)
    Re: Prefix matching for filenames? <nobull@mail.com>
    Re: Prefix matching for filenames? <wcitoan@NOSPAM-yahoo.com>
    Re: Prefix matching for filenames? <tzz@lifelogs.com>
    Re: Prefix matching for filenames? <wcitoan@NOSPAM-yahoo.com>
    Re: printing hash values (Ingo Fellner)
    Re: Setup user-password in .htaccess <abigail@abigail.nl>
    Re: Substitution and regex question (Domenico Discepola)
    Re: Substitution and regex question <tore@aursand.no>
    Re: tough regex problem (Domenico Discepola)
    Re: tough regex problem (Tad McClellan)
        uninitialized value <tkb3@att.net>
    Re: uninitialized value <nobull@mail.com>
    Re: uninitialized value <tkb3@att.net>
        WWW::Mechanize - Can't add via PPM3 in ActiverPerl 5.8 <finisterre@postmaster.co.uk>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Fri, 07 Mar 2003 17:45:38 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Lightweight CGI module?
Message-Id: <pan.2003.03.07.16.12.48.346379@aursand.no>

On Fri, 07 Mar 2003 11:12:10 +0000, Helgi Briem wrote:
>>> mod_perl runs on almost any platform that Apache runs on. Why not use
>>> mod_perl if the server is Apache?

>> I'm not in charge of the web server part.  The "customer" is either
>> already running a web server (ie. won't switch to anything else), or is
>> running Windows (ie. prefers IIS no matter how bad it is).

> Most apache web servers in the world run on Windows.

Not an argument;  Must customers aren't interested in Apache, as they're
already running another web server (not necessarily IIS).

Customers are assholes, I know, and in this case they are satisfied with
what they've got, and just want me to install my damn application.  No
matter how much sweat and tears that is for me, they're not feeling any
sympathy for me until the thing works.

That's life. :)


-- 
Tore Aursand <tore@aursand.no>



------------------------------

Date: Fri, 07 Mar 2003 17:45:39 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Lightweight CGI module?
Message-Id: <pan.2003.03.07.16.26.39.513984@aursand.no>

On Fri, 07 Mar 2003 11:10:58 +0000, Helgi Briem wrote:
>> I know.  Bad use of the bottleneck from me.  I _know_ that CGI.pm is
>> pretty bloated, and I _know_ that it'll give me better overall
>> performance if I had a smaller/lighter one.

> You don't know that *at all*.

Oh yes.  Have a look at the benchmarked code in a previous message.  Test
it yourself, if you'd like.  Is it my Athlon 750MHz that's behaving
abnormally? :)


-- 
Tore Aursand <tore@aursand.no>



------------------------------

Date: Fri, 07 Mar 2003 17:45:39 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Lightweight CGI module?
Message-Id: <pan.2003.03.07.16.25.13.168464@aursand.no>

On Fri, 07 Mar 2003 06:28:24 -0600, Eric J. Roode wrote:
> Again, I have to ask:  What makes you "_know_" that CGI.pm is slowing
> you down?

Just do a benchmark.  I created the following script, ran it under
mod_perl and benchmarked it using 'ab';

  #!/usr/bin/perl
  #
  use strict;
  use warnings;

  use CGI; # Also tried 'use CGI(); CGI->compile()', but there
           # were no difference in performance.  Shouldn't it be?
  my $cgi = CGI->new();

  print qq|Content-type: text/html

  <html>
  <head>
  <title>mod_perl</title>
  </head>
  <body>
  <h1>Environment</h1>
  <ul>
  |;

  foreach ( sort keys %ENV ) {
      print '<li>' . $_ . ' = ' . $ENV{$_} . '</li>' . "\n";
  }

  print qq|</ul>
  </body>
  </html>
  |;

My computer managed to serve this script approx. 220 times per second with
'my $cgi = CGI->new()' as above.  Removing that line, and adding my tiny
CGI module instead, my computer managed to handle 300 requests per second.


-- 
Tore Aursand <tore@aursand.no>



------------------------------

Date: Fri, 07 Mar 2003 17:32:38 GMT
From: Eric McDaniel <ericm-NOSPAM-@vertical.com>
Subject: Re: Obfuscated Perl Challenge
Message-Id: <Xns9337612A84B5Fooheehoohahah@207.225.159.6>

Benjamin Goldberg <goldbb2@earthlink.net> wrote in news:3E685F6E.C3E9A517
@earthlink.net:

> Can anyone guess/figure out what this code does, without running it?
> 
> @1=a..c;$;=4;{push@2,map[$;--,@1[0,2,1]=@1
>],2..$;x--$|;print"$1[0]=>$1[2]\n";--$;?@1
>]=@1[1,0,2]:(($;,@1)=@{pop@2||last});redo} 
> 
> A large part of the obfuscation is because the flow control is
> significantly different from the way this particular algorithm is
> normally implemented, so even using Deparse won't significantly help
> you.
> 
> Have fun, and Good Luck!

Was the syntax error an intentional part of the obfuscation? Well anyway, 
after fixing the error I still gave up and ran it. Clever.

syntax error at f2.pl line 3, near "@1
]"
Unmatched right curly bracket at f2.pl line 3, at end of line
syntax error at f2.pl line 3, near "redo}"
Execution of f2.pl aborted due to compilation errors.


------------------------------

Date: Fri, 07 Mar 2003 15:35:50 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Obfuscated Perl Challenge
Message-Id: <3E6902A6.BEBD76B7@earthlink.net>

Eric McDaniel wrote:
> Benjamin Goldberg wrote:
> 
> > Can anyone guess/figure out what this code does, without running it?
> >
> > @1=a..c;$;=4;{push@2,map[$;--,@1[0,2,1]=@1
> >],2..$;x--$|;print"$1[0]=>$1[2]\n";--$;?@1
> >]=@1[1,0,2]:(($;,@1)=@{pop@2||last});redo}

That's not what I wrote.  Your newsreader apparently added an extra "]"
char for some strange reason.

Adding some whitepsace to my original code, you should have:

   @1 = a..c;
   $; = 4;
   {
      push @2, map [ $;--, @1[0,2,1]=@1 ], 2 .. $; x --$|;
      print "$1[0]=>$1[2]\n";
      --$; ?
         @1 = @1[1,0,2] :
         (($;,@1) = @{ pop @2 || last });
      redo;
   }

> > A large part of the obfuscation is because the flow control is
> > significantly different from the way this particular algorithm is
> > normally implemented, so even using Deparse won't significantly help
> > you.
> >
> > Have fun, and Good Luck!
> 
> Was the syntax error an intentional part of the obfuscation? Well
> anyway, after fixing the error I still gave up and ran it. Clever.
> 
> syntax error at f2.pl line 3, near "@1
> ]"
> Unmatched right curly bracket at f2.pl line 3, at end of line
> syntax error at f2.pl line 3, near "redo}"
> Execution of f2.pl aborted due to compilation errors.

-- 
@1=a..c;$;=4;{push@2,map[$;--,@1[0,2,1]=@1
],2..$;x--$|;print"$1[0]=>$1[2]\n";--$;?@1
=@1[1,0,2]:(($;,@1)=@{pop@2||last});redo}


------------------------------

Date: 07 Mar 2003 21:28:39 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Obfuscated Perl Challenge
Message-Id: <slrnb6i3o7.r9j.abigail@alexandra.abigail.nl>

Benjamin Goldberg (goldbb2@earthlink.net) wrote on MMMCDLXXV September
MCMXCIII in <URL:news:3E685F6E.C3E9A517@earthlink.net>:
||  Can anyone guess/figure out what this code does, without running it?
||  
||  @1=a..c;$;=4;{push@2,map[$;--,@1[0,2,1]=@1
||  ],2..$;x--$|;print"$1[0]=>$1[2]\n";--$;?@1
|| =@1[1,0,2]:(($;,@1)=@{pop@2||last});redo}
||  
||  A large part of the obfuscation is because the flow control is
||  significantly different from the way this particular algorithm is
||  normally implemented, so even using Deparse won't significantly help
||  you.

After a few seconds, I guessed "Towers of Hanoi". Running it seems
to confirm the guess.

The 0, 1, 2 permutations are a giveaway.



Abigail
-- 
# Needs perl 5.005_03 or *earlier*.
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi


------------------------------

Date: 7 Mar 2003 10:07:24 -0800
From: danparker276@yahoo.com (Krusty)
Subject: Re: perlcc error (cl and link)
Message-Id: <f4a9a3fc.0303071007.9ed0284@posting.google.com>

Oh wait I need visual C installed?  I though perl came with it

rook_5150@yahoo.com (Bryan Castillo) wrote in message news:<1bff1830.0303062032.1eacf5c5@posting.google.com>...
> > > this is the error I get, I'm using active perl for windows.
> > > 
> > > 'cl' is not recognized as an internal or external command,
> > > operable program or batch file.
> > > 'link' is not recognized as an internal or external command,
> > > operable program or batch file.
> > > 
> > > 
> > > anyone know what's going on?
> > 
> > 
> > cl is the cmdline version of M$VC++ AFAIK. I assume 'link' has
> > something to do with that too. Either they're not installed, or not
> > in your %PATH%.
> 
> You can look at this batch file to see how your environment should be
> set for compiling and linking with MS. (substitute your install dir
> though)
> 
> C:\Program Files\Microsoft Visual Studio\VC98\Bin\Vcvars32.bat


------------------------------

Date: 7 Mar 2003 10:41:04 -0800
From: adwser@hotmail.com (jtd)
Subject: Prefix matching for filenames?
Message-Id: <c57c103.0303071041.3caefb42@posting.google.com>

I have a directory with tens of thousands of files with numbers as
filenames:

00010.dat
00039.dat
00072.dat
00118.dat
 ...
30301.dat

Given a number, say 00092, how can I efficiently find the largest
filename that is less than or equal to the number? In this example,
the answer is 00072.dat. I'm using Reiserfs, so the number of files is
not a problem.

1) I could keep a separate file with a list of filenames in the
directory, and do a binary search on the list, but since the
directory's data blocks already has this information, it seems a bit
redundant to me. Readdir only supports linear searching, and seekdir
and telldir appear to be useless.

2) Berkeley DB's Btree database supports prefix matching, but the
BerkeleyDB module is flaky when it comes to multiple writers, and I
don't want to risk a hundred GB database.

Any suggestions are much appreciated!

Jeff TD


------------------------------

Date: 07 Mar 2003 19:09:41 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Prefix matching for filenames?
Message-Id: <u93clz56yy.fsf@wcl-l.bham.ac.uk>

adwser@hotmail.com (jtd) writes:

> 1) I could keep a separate file with a list of filenames in the
> directory, and do a binary search on the list, but since the
> directory's data blocks already has this information, it seems a bit
> redundant to me. Readdir only supports linear searching, and seekdir
> and telldir appear to be useless.

You first question muct be does your OS provides some non-linear
user-space interface to the directory structure?

The answer is almost cerainly no.

Looking for a way to get at this interface with Perl is therefore moot.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: Fri, 07 Mar 2003 19:52:56 -0000
From: "W. Citoan" <wcitoan@NOSPAM-yahoo.com>
Subject: Re: Prefix matching for filenames?
Message-Id: <slrnb6hu4i.1r7.wcitoan@wcitoan-via.supernews.com>

On 7 Mar 2003 10:41:04 -0800, jtd wrote:
>  
>  Given a number, say 00092, how can I efficiently find the largest
>  filename that is less than or equal to the number? In this example,
>  the answer is 00072.dat. I'm using Reiserfs, so the number of files is
>  not a problem.
>  
>  1) I could keep a separate file with a list of filenames in the
>  directory, and do a binary search on the list, but since the
>  directory's data blocks already has this information, it seems a bit
>  redundant to me. Readdir only supports linear searching, and seekdir
>  and telldir appear to be useless.

I would consider doing something like this:

  opendir(DIR, $directory);
  my @files = grep /\.dat$/ readdir(DIR);
  close DIR;

  @files = sort @files;
  
  my $result;
  for (@files) {
    my $prefix = split /\./, $_;
    if ( $prefix <= 00092 ) {
      $result = $prefix;
    }
  }

  print "Largest <= 00092 is $result.dat\n";

That's rough, but something along those lines should do the job.


- W. Citoan
-- 
If more of us valued food and cheer and song above hoarded gold, it would
be a merrier world.
		-- J.R.R. Tolkien


------------------------------

Date: Fri, 07 Mar 2003 15:18:34 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: Prefix matching for filenames?
Message-Id: <4nbs0n3p7p.fsf@lockgroove.bwh.harvard.edu>

On 7 Mar 2003, adwser@hotmail.com wrote:
> Given a number, say 00092, how can I efficiently find the largest
> filename that is less than or equal to the number? In this example,
> the answer is 00072.dat. I'm using Reiserfs, so the number of files
> is not a problem.
> 
> 1) I could keep a separate file with a list of filenames in the
> directory, and do a binary search on the list, but since the
> directory's data blocks already has this information, it seems a bit
> redundant to me. Readdir only supports linear searching, and seekdir
> and telldir appear to be useless.

The directory does not keep a sorted list of files, that's the
problem.  You could structure your directories, e.g. 00092 is under
the 0/0/0/9 directory, but that's unpleasant.  Also, you could use
something like 00092.1 to mean "the one to follow 00092" and 00092.1.1
for the one to follow 00092.1, and so on.  Then you just have to
adjust your sorting algorithm.

I would hook into the file creation/deletion process and maintain a
sorted list if you want to avoid the expense of scanning the
directory.

Ted


------------------------------

Date: Fri, 07 Mar 2003 20:26:49 -0000
From: "W. Citoan" <wcitoan@NOSPAM-yahoo.com>
Subject: Re: Prefix matching for filenames?
Message-Id: <slrnb6i047.1r7.wcitoan@wcitoan-via.supernews.com>

On Fri, 07 Mar 2003 19:52:56 -0000, W. Citoan wrote:
>
>      my $prefix = split /\./, $_;

That, of course, should have been:

       my $prefix = (split /\./, $_)[0];


- W. Citoan
-- 
Bedfellows make strange politicians.


------------------------------

Date: 7 Mar 2003 08:05:14 -0800
From: i.fellner@puz.de (Ingo Fellner)
Subject: Re: printing hash values
Message-Id: <89e91023.0303070348.499f3db5@posting.google.com>

Barry Kimelman <barryk2@SPAM-KILLER.mts.net> wrote in message news:<MPG.18d1158e994112f2989730@news.mts.net>...
> In article <b09a22ae.0303051922.4654a4eb@posting.google.com>, david 
> (dwlepage@yahoo.com) says...
> > If I have lexical values:
> > my ($keyname, $keyvalue, $search, $replace);
> > my %uid ();
> > 
> > What would be the best way to print the contents of my hash once it
> > has been populated? I am new to perl and am having a hard time
> > visualizing the whole hash concept. Any suggestions?
> > Thanks,
> > 
> 
> Several possibilities :
> 
> while ( ($key,$value) = each %uid ) {
>     print "$key --> $value\n":
> }
> 
> 
> print join(", ",map { $_ . " -> " . $uid{$_} }),"\n";

You forgot to supply a list to "map":

	print join(", ",map { $_ . " -> " . $uid{$_} } keys %uid ),"\n";

You can test such things with %ENV, for example:

	perl -e 'print join(", ",map { $_ . " -> " . $ENV{$_} } keys %ENV ),"\n";'


Greetings,

Ingo ;-)))


------------------------------

Date: 07 Mar 2003 21:56:21 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Setup user-password in .htaccess
Message-Id: <slrnb6i5c5.r9j.abigail@alexandra.abigail.nl>

Serg (absolute8@sprint.ca) wrote on MMMCDLXXV September MCMXCIII in
<URL:news:70f45cd3.0303070718.373ec204@posting.google.com>:
??  How can I modify .htaccess for Apachi so that it will accept any
??  username but only one correct password?

And your Perl question is ?


Abigail
-- 
sub camel (^#87=i@J&&&#]u'^^s]#'#={123{#}7890t[0.9]9@+*`"'***}A&&&}n2o}00}t324i;
h[{e **###{r{+P={**{e^^^#'#i@{r'^=^{l+{#}H***i[0.9]&@a5`"':&^;&^,*&^$43##@@####;
c}^^^&&&k}&&&}#=e*****[]}'r####'`=437*{#};::'1[0.9]2@43`"'*#==[[.{{],,,1278@#@);
print+((($llama=prototype'camel')=~y|+{#}$=^*&[0-9]i@:;`"',.| |d)&&$llama."\n");


------------------------------

Date: 7 Mar 2003 09:06:28 -0800
From: joeminga@yahoo.com (Domenico Discepola)
Subject: Re: Substitution and regex question
Message-Id: <698c67f.0303070614.169460c2@posting.google.com>

Brian McCauley <nobull@mail.com> wrote in message news:<u9u1eg5in3.fsf@wcl-l.bham.ac.uk>...
> joeminga@yahoo.com (Domenico Discepola) writes:
> 
> > Whenever I see four pipes in $_, I want to replace the 4 pipes with a
> > single \r\n
> > 
> > here's my substitution command:
> > 
> > $_ =~ s/||||/\r\n/g;
> 
> BTW: why do you tell Perl: "don't act on $_, act on $_ instead"?
> 
> > Why doesn't this work (I'm using perl for cygwin)?  It does not find
> > the match and my $_ still contains 4 pipes
> 
> The character | is special in regex.  You musescape it as \|
> 
> > Any thoughts?
> 
> Well as you ask...
> 
> I think newsgroups should not be used as an alternative to reference
> manuals.
> 
> Since you say in your subject line "Substitution and regex question" I
> think you should have considered reading the sections of the Perl
> manual that explain the Perl substitution operator and the Perl regex
> syntax before posting to Usenet.


You're not going to believe this...  It now works (surprise surprise):

#!perl -w

my $a = "aaaa||bbbb|||ccc||||dd|eee|ggg||||jjjjJJJJjjjjj||u 
	||||hhhgf";

printf("Original string: %s\n", $a);
printf "\n\n";
$a =~ s/\|\|\|\|/\r\n/g;
printf("New string: %s\n", $a);

The reason I posted this message is because I was going crazy trying
to figure out why my substitution was not being matched.  I was trying
all combinations including s/(||||)/\r\n/g; and s/(\|\|\|\|)/\r\n/g;

I should mention I'm running activestate's perl on windows xp (v5.6.1
build 633).  The only thing I did differently today is rebooted...


------------------------------

Date: Fri, 07 Mar 2003 19:10:18 +0100
From: "Tore Aursand" <tore@aursand.no>
Subject: Re: Substitution and regex question
Message-Id: <pan.2003.03.07.17.58.23.377775@aursand.no>

On Fri, 07 Mar 2003 09:06:28 -0800, Domenico Discepola wrote:
> $a =~ s/\|\|\|\|/\r\n/g;

Just a tip;  This does the same thing, and is - IMO - easier to read:

  $a =~ s,\|{4},\r\n,g;

I even think that using ',' instead of '/' is easier to read. :)


-- 
Tore Aursand <tore@aursand.no>


------------------------------

Date: 7 Mar 2003 09:30:26 -0800
From: joeminga@yahoo.com (Domenico Discepola)
Subject: Re: tough regex problem
Message-Id: <698c67f.0303070657.96f5b66@posting.google.com>

tiltonj@erols.com (Jay Tilton) wrote in message news:<3e66f862.16241203@news.erols.com>...
> joeminga@yahoo.com (Domenico Discepola) wrote:
> 
> : A text file I've been presented with is described as follows:
> : 
> : field seperator: \r\n\r\n\r\n\x07
> : row seperator: \r\n\r\n\r\n\r\n
> : 
> : I'm trying to replace the above field seperator with a single \x07 and
> : the row seperator with a single \r\n
> 
>     $/ = "\r\n\r\n\r\n\r\n";   # input record separator
>     $\ = "\r\n";               # output record separator
>     $ifs = "\r\n\r\n\r\n\x07"; # input field separator
>     $, = "\x07";               # output field separator
>     while( <> ) {
>         chomp;
>         print split /$ifs/;
>     }

Thanks to all for their input.  I'd like to mention that my
'confusion' has to do with activestate perl running on windows xp. 
The reason I got those "uncommon" field and record seperators is
because the way print and printf works on my system.  A hex-dump of
the original input file revealed no \r\n - just the \x07.  Then, when
I introduced printf("%s\n", $a); and piped that through to hexdump, it
revealed a \r\n (not just a \n).  Is it fair to state that Microsoft
Windows XP automatically converts a \n to \r\n?


------------------------------

Date: Fri, 7 Mar 2003 14:15:23 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: tough regex problem
Message-Id: <slrnb6hver.ark.tadmc@magna.augustmail.com>

Domenico Discepola <joeminga@yahoo.com> wrote:

> Is it fair to state that Microsoft
> Windows XP automatically converts a \n to \r\n?


No, but Perl on that platform does, unless you:

   perldoc -f binmode


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Fri, 07 Mar 2003 19:54:41 GMT
From: "Tony" <tkb3@att.net>
Subject: uninitialized value
Message-Id: <5O6aa.5962$1v.405522@bgtnsc04-news.ops.worldnet.att.net>

Hi Everyone,

Fairly new to the group here (and perl), so if this is an inappropriate
post, please forgive me. I've got the Learning Perl book plus a few
others...but I'm still scratching my head over this one.
 
Just a beginning test page where the end-user submits a name and gets a
page back with that name in it.  The page works,however, the warning I
keep getting is:

"Use of uninitialized value in concatenation (.) or string..."
 
I also noticed this same type of warning when I attempt to take the same
thing (user input) and try to compare it to another variable, using this
example--> $my other variable=~/$name/ operator. I can't get anything to
match.
 
Here is a snippet of code that will generate the error messsage above:
 
 
#!c:\Perl\Perl5.00402\bin\perl.exe -w
#Set Perl Parameters
#use strict;
#The CGI.pm module will take input from the form and process it for you.
use CGI qw(:standard);
my $name=param("name");

print "<h2>You entered: $name <p>\n";


Thanks in advance for any help you might be able to provide a newbie.


If you know of any other urls, etc. that might help, with some examples,
that would be great.....


Tony



------------------------------

Date: 07 Mar 2003 20:42:20 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: uninitialized value
Message-Id: <u9heae52oj.fsf@wcl-l.bham.ac.uk>

"Tony" <tkb3@att.net> writes:
> 
> Fairly new to the group here (and perl), so if this is an inappropriate
> post, please forgive me. I've got the Learning Perl book plus a few
> others...but I'm still scratching my head over this one.
>
> Just a beginning test page where the end-user submits a name and gets a
> page back with that name in it.  The page works,however, the warning I
> keep getting is:
> 
> "Use of uninitialized value in concatenation (.) or string..."

This particular error message is itself erroneous (although the
explaination in the perldiag reference manual is more-or-less correct).

"uninitialized value" is a meaningless concept.

Most people suconciously change it to "uninitialized variable".

Unfortunating it actually should read "undefined value".
  
> I also noticed this same type of warning when I attempt to take the same
> thing (user input) and try to compare it to another variable, using this
> example--> $my other variable=~/$name/ operator. I can't get anything to
> match.

What do you think the =~ operator does?  Compare this with the
documentation.  The string equality operator is 'eq'.

>  
> Here is a snippet of code that will generate the error messsage above:
>  
>  
> #!c:\Perl\Perl5.00402\bin\perl.exe -w

Perl 5.4 is very old.

> #Set Perl Parameters
> #use strict;

Why have you removed one of the safety guards?

Keep it in place until you are very skilled - then only remove it when
you need to.

> #The CGI.pm module will take input from the form and process it for you.
> use CGI qw(:standard);
> my $name=param("name");
> 
> print "<h2>You entered: $name <p>\n";

It would appear that the HTTP request did not contain an encoded HTML
form with a field 'name'.

Then again it's hard to know what's going on be cause you are not
showing us your real code.  That code emits no CGI response header so
would not work.

> Thanks in advance for any help you might be able to provide a newbie.

When posting a programming question to Usenet always include a short
but complete program.  This and much other important advice can be
found in the posting guidelines.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: Fri, 07 Mar 2003 21:28:09 GMT
From: "Tony" <tkb3@att.net>
Subject: Re: uninitialized value
Message-Id: <J98aa.5083$Oz1.403241@bgtnsc05-news.ops.worldnet.att.net>

Ok....thanks!  I will check them out.

As to the whole code, I don't really have a final program yet, just been
trying various snippets to see what works best.


I will look at the form and the perl and try to finalize the 
code before posting any more.


thanks again.





On Fri, 07 Mar 2003 20:42:20 +0000, Brian McCauley wrote:

> "Tony" <tkb3@att.net> writes:
>> 
>> Fairly new to the group here (and perl), so if this is an inappropriate
>> post, please forgive me. I've got the Learning Perl book plus a few
>> others...but I'm still scratching my head over this one.
>>
<snip>


------------------------------

Date: Fri, 7 Mar 2003 17:47:09 -0000
From: "Fred Finisterre" <finisterre@postmaster.co.uk>
Subject: WWW::Mechanize - Can't add via PPM3 in ActiverPerl 5.8
Message-Id: <b4altk$7ni$1@newsg3.svr.pol.co.uk>

Anyone know why? Why would it not be in the ActiveState Perl repositories?

"search mechanize" doesn't list it.

Thanks,

Fred.




------------------------------

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.  

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 4682
***************************************


home help back first fref pref prev next nref lref last post