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

Re^2: Can the "#" character be passed via $ENV{QUERY_STRING} ?

by mdillon (Priest)
on Feb 24, 2005 at 21:35 UTC ( [id://434344]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: Can the "#" character be passed via $ENV{QUERY_STRING} ?
in thread Can the "#" character be passed via $ENV{QUERY_STRING} ?

You don't need to load all of CGI to do this if you are taking the whole QUERY_STRING as a single value. You can use URI:Escape directly. It is an extremely lightweight module. You'll want to use uri_unescape, like so:
use URI::Escape qw(uri_unescape); my $query_string = uri_unescape $ENV{QUERY_STRING};

Replies are listed 'Best First'.
Re^3: Can the "#" character be passed via $ENV{QUERY_STRING} ?
by BUU (Prior) on Feb 25, 2005 at 01:46 UTC
    Just to note, uri_unescape is functionally:  s/%(\d\d)/chr $1/eg; if you don't even want to load the module.
      I think that should be:
      s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg
      In fact, that's pretty much exactly what's in URI::Escape, except that the module also handles scalar v. list context and multiple arguments. Using uri_unescape still seems preferable to me, since the resource overhead of using the module is basically nil and the mnemonic benefit of seeing uri_unescape instead of a regex is considerable.
        You know, you're completely correct, and that mostly proves your point about using a module. I theoretially knew what the proper code should be, but I wasn't paying attention and wrote something that was broken and didn't even think about it, the module would have been much easier.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://434344]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.