Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

My parameters can't escape from the Sun...

by Anonymous Monk
on Aug 02, 2000 at 00:08 UTC ( [id://25570]=perlquestion: print w/replies, xml ) Need Help??

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

This one has me baffled. I am getting the following result from using $cgi_obj->escape("some_value"): CGI=HASH(0x1d7820) This is NOT what anyone would normally expect from a call to escape, and unescape produces similar output. My key difference is that I'm on a Sun machine running SunOS 5.6 (it appears from running 'uname') whereas I've never had this problem on linux or windows. Any body care to comment? Thanks. Mike

Originally posted as a Categorized Question.

Replies are listed 'Best First'.
Re: My parameters can't escape from the Sun...
by davorg (Chancellor) on Aug 02, 2000 at 00:30 UTC

    I think this is a problem with older versions of CGI.pm. In older versions on the module (and I can't remember when it changed) the escape subroutine didn't have a OO interface, so it expected its first parameter to be the string to be escaped.

    By calling it with an OO interface, as you have, you give it the CGI object as the first parameter. escape tries to URL encode that object and returned the URL encoded version. When you print out the return code, you the string representation of the object, which is the type and reference - hence the output you see.

    Solutions: 1/ Get a more recent version of CGI.pm. 2/ Call escape using the functional interface like this:

    $escaped = escape('some text');
Re: My parameters can't escape from the Sun...
by autark (Friar) on Aug 02, 2000 at 00:26 UTC
    Maybe you are trying to interpolate method calls in strings? Unfortunatly, function- and method calls will not interpolate in strings. So you might try something like this instead: print "Got: ", $cgi->escape("some_value"), "\n"; Well, you can do something like the following, but I don't think it's pretty: print qq(Got: @{[ $cgi->escape("some_value") ]}\n); Autark

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-03-29 08:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found