Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The "@aol" appears nowhere in my code - it is part of an email address that some user is submitting. My code compiles and runs fine and uses both warnings and use strict - it works most of the time, but these errors sometimes occur.Use of uninitialized value in subroutine entry at /usr/local/lib/perl5 +/site_perl/5.6.1/URI/Escape.pm line 140. [Fri Apr 12 14:16:18 2002] [error] Can't use string ("") as a subrouti +ne ref while "strict refs" in use at /usr/local/lib/perl5/site_perl/5 +.6.1/URI/Escape.pm line 140. Possible unintended interpolation of @aol in string at (eval 187) line + 1. [Fri Apr 12 14:28:22 2002] [error] uri_escape: Global symbol "@aol" re +quires explicit package name at (eval 187) line 1. at /usr/local/apache/perl/some.cgi line 179 Possible unintended interpolation of @aol in string at (eval 185) line + 1.
It seems that somehow the strings that are being passed to URI::Escape, which eval's a regex in an anonymous subroutine, are being seen as code, specifically the "@" in email addresses, and causing an error - but only some of the time.#a bunch of lines like the following to get POST'd data: my $email = uri_escape($apr->param('email' ))||''; my $customerid = uri_escape($apr->param('customerID'))||''; #then get a ref to a hash of all posted values #it's redundant, i know, but it serves a purpose my $values = $apr->param; #later, to construct a redir, this hack: my $base_url = "http://foo.com/somecgi?"; my $middle = join('&', map { $_ . "=" .uri_escape($values->{$_}) } keys %$values ); my $tail = "&FilePath=$cleanfilename&transfer_source=http"; my $redir = $base . $middle . $tail; # sub to construct a log string or submitted info # anonymous to avoid warnings under mod_perl my $err_log = sub { my $up = shift; my @vars = ( $up, $clientb, $clientbv, $clientos, $trckingnum, $customerid, $xferid, $cgi,$customerid, $contactname, $email,$phone,'htttp' ); my $string = join(',', map {"\"" . $_ . "\""} map {uri_unescape($_)} @vars ); $string .= "\012"; return $string; };
Edit kudra, 2002-04-16 Added readmore
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: incorrect use of URI::Escape?
by Juerd (Abbot) on Apr 13, 2002 at 17:23 UTC | |
by tachyon (Chancellor) on Apr 13, 2002 at 18:13 UTC | |
by Juerd (Abbot) on Apr 13, 2002 at 18:27 UTC | |
by tachyon (Chancellor) on Apr 13, 2002 at 18:57 UTC | |
by Juerd (Abbot) on Apr 13, 2002 at 19:02 UTC | |
|
•Re: incorrect use of URI::Escape?
by merlyn (Sage) on Apr 13, 2002 at 17:25 UTC | |
by tachyon (Chancellor) on Apr 13, 2002 at 17:42 UTC | |
by Anonymous Monk on Apr 13, 2002 at 17:59 UTC | |
by Juerd (Abbot) on Apr 13, 2002 at 17:59 UTC |