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

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



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...)

Question: Did I miss this change, or did someone at RH mis-apply a patch?  (I am leaning toward a functional change to increase security and make the CGI object more OO-correct...)  I read the Perl change logs from 5.8 through 5.10.1 but didn't see this noted.

Dan

Here's my test code:
     1  #!/usr/bin/perl -w
     2  use strict;
     3  use CGI;
     4  use Data::Dumper;
     5  my $perl_version = $];
     6  my $cgi;
     7  my $report;
     8
     9  print "Content-type: text/html\n\n";
    10  print "<html><head>\n";
    11  print "<title>CGI Test</title>\n";
    12  print "</head>\n";
    13  print "<body>\n";
    14  print "Testing with version: $perl_version\n";
    15  print "<pre>";
    16  # Create CGI object
    17  $cgi = CGI->new();
    18
    19  $report = $cgi->{report};
    20  print "Raw report variable:";
    21  print Dumper $report;
    22  print "\n";
    23
    24  $report = $cgi->param('report');
    25  print "Report variable with param:";
    26  print Dumper $report;
    27  print "\n";
    28  print "<\pre>";
    29  exit;

On CentOS 5.5, the page reports this:
Testing with version: 5.008008
Raw report variable:$VAR1 = [
          'MyReportName'
        ];

Report variable with param:$VAR1 = 'MyReportName';


On the RedHat 6 box, this is the output:
Testing with version: 5.010001
Raw report variable:$VAR1 = undef;

Report variable with param:$VAR1 = 'MyReportName';

--
***************** ************* *********** ******* ***** *** **
"Quis custodiet ipsos custodes?"
    (Who can watch the watchmen?)
    -- from the Satires of Juvenal
"I do not fear computers, I fear the lack of them."
    -- Isaac Asimov (Author)
** *** ***** ******* *********** ************* *****************