Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

CGI Module behavior changes between Perl 5.8.1 and 5.8.8?

by jsignal (Initiate)
on Feb 15, 2006 at 00:24 UTC ( [id://530266]=perlquestion: print w/replies, xml ) Need Help??

jsignal has asked for the wisdom of the Perl Monks concerning the following question:

I'm having a difficult time after upgrading from Perl 5.8.1 to 5.8.8.

I support an application that creates a CGI object, calls the CGI::path_info($new_pathinfo) method with a parameter to set the variable in the object, and then spits out a URL by calling CGI->url(-relative=>0,-query=>1,-path_info=>1).

This simple script exhibits the differing output between the versions of the Perl interpreter:

The Code:

#!/usr/bin/perl use CGI; my $cgi = new CGI; print $cgi->header(); print("Created CGI.<br>\n"); printCgi($cgi); $cgi->path_info("/pathinfo1"); print("Set path_info to \"/pathinfo1\".<br>\n"); printCgi($cgi); sub printCgi(){ my $cg = shift; print("*********************************************************** +*******<br>\n"); print(" URL: ".$cg->url(-path_info=>1,-relative=>0,-query=> +1)."<br>\n"); print("path_info(): ".$cg->path_info()."<br>\n"); print("*********************************************************** +*******<br>\n"); }

The Output:

When I browse to http://servername/cgi-bin/cgitest.cgi/AAAA on a server with Perl 5.8.1, I get this output:

Created CGI. ****************************************************************** URL: http://servername/cgi-bin/cgitest.cgi/AAAA path_info(): /AAAA ****************************************************************** Set path_info to "/pathinfo1". ****************************************************************** URL: http://servername/cgi-bin/cgitest.cgi/pathinfo1 path_info(): /pathinfo1 ******************************************************************

If I browse to the EXACT SAME SCRIPT on a server running Perl 5.8.8, I get this output:

Created CGI. ****************************************************************** URL: http://servername/cgi-bin/cgitest.cgi/AAAA path_info(): /AAAA ****************************************************************** Set path_info to "/pathinfo1". ****************************************************************** URL: http://servername/cgi-bin/cgitest.cgi/AAAA/pathinfo1 path_info(): /pathinfo1 ******************************************************************

This change in the behavior of the CGI module is causing me big headaches. If anyone has suggestions, please let me know!

Thanks,
Jason

Replies are listed 'Best First'.
Re: CGI->pathinfo() and CGI->url() not working together after upgrade
by YuckFoo (Abbot) on Feb 15, 2006 at 03:07 UTC
    jsignal,

    You have a typo. Try '-path_info=>1' instead.

    YuckFoo

      Oh, I wish that was my problem! That was a typo in my post, not in my actual code. Thanks for the suggestion. -Jason
Re: CGI Module behavior changes between Perl 5.8.1 and 5.8.8?
by jsignal (Initiate) on Jun 12, 2006 at 18:55 UTC
    I'm still having this problem. I've rebuilt Perl several times with the same results. Has ANYONE seen this? Thanks, jsignal

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://530266]
Approved by polettix
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (2)
As of 2024-04-20 03:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found