[Van-pm] CGI taint mode
Vincent Li
mcli at brc.ubc.ca
Tue Dec 6 14:07:53 PST 2005
> Vincent Li wrote:
> [...]
>>>>43 print h2('File MIME type'),
>>>>44 uploadInfo($file)->{'Content-Type'};
>>
>>
>> But line 44 uploadinfo function see $file as undefined. line 42 and 44
>> are
>> in the same scope, I don't understand why line 42 and 44 see $file
>> differently.
>
> It doesn't see it as undefined. It just doesn't find that file and
> uploadInfo($file) returns undef. So you need to write it as:
>
>
> if (my $info = uploadInfo($file)) {
> print $info->{'Content-Type'};
> }
> else {
> warn "can't find $file";
> }
Now I understand, I rewrote the script as you said, it gives me "Global
symbol "$info" requires explicit package name....". I changed it to
my $info = uploadInfo($file);
if ($info) {
print $info->{'Content-Type'};
}
else {
warn "can't find $file";
}
then, no error complain, but nothing wrong with your declarartion of
$info. In error_log, it did say the file could not be found. What
reason cause the file not be found?
--
Vincent Li
System Admin, UBC
http://mcli.homelinux.org:8080
More information about the Vancouver-pm
mailing list