[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Omaha.pm] Change in CGI.pm from 5.8 to 5.10...?



On Feb 22, 2011, at 10:12 AM, Dan Linder wrote:
> The code I'm keeping updated has lots of lines like this:
>     $cgi = CGI->new();
>     $report = $cgi->{report};
> 
> (To pull in the "report=" value from the URL: http://testrh6/bin/test.cgi?report=MyReportName)
> 
> When I was testing it on a RedHat 6 system running Perl 5.10.1, the $report variable was coming up as undefined, but on the test systems running Perl 5.8, it was just fine.
> 
> The fix is to use the param() method like this:
>     $report = $cgi->param('report');
> 
> Looks like I have a lot of code to fix.  (IMHO it was broken before, just Perl was being nice about it...)

Ha! I just hit the EXACTLY EQUIVALENT issue in old PHP code yesterday!  Small world.   :)   

   (In PHP "register_globals" has been deprecated sometime between 2002 and now.)

These change(s) wouldn't be listed in the Perl change log, they'd be noted in CGI's Changes file:

   http://cpansearch.perl.org/src/MARKSTOS/CGI.pm-3.52/Changes

Which, strangely, doesn't list the date of each release (when was 2.50 released? maybe that was the change point for your behavior).

Anyway, yes, $object->{...} is always evil and you're right to move away from it.

$cgi->Vars() is available and is probably the closest to your old code without all the evil:

   http://search.cpan.org/~markstos/CGI.pm-3.52/lib/CGI.pm#FETCHING_THE_PARAMETER_LIST_AS_A_HASH:

RedHat deserves no fault nor credit for this change.   :)

Hope that helps,

Jay Hannah
Software Architect
jhannah@mutationgrid.com | http://mutationgrid.com | 1-402-598-7782