Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Where is URI::Escape::DWIM

by YuckFoo (Abbot)
on Jun 10, 2008 at 19:35 UTC ( #691316=perlquestion: print w/ replies, xml ) Need Help??
YuckFoo has asked for the wisdom of the Perl Monks concerning the following question:

I know I'm several years late to the party with this, but we recently, finally, updated URI::Escape. I'm sure it's all real up-to-date and real correct and real conformant with the latest RFC and whatever, but I liked it better when it just worked, DWIM.
#!/usr/bin/perl use URI::Escape; my $link = 'httpd://www.example.com/stuff/this and that.pl?foo=bar'; $link = uri_escape($link); if ($gimme_what_i_want) { $link =~ s!%2F!/!g; $link =~ s!%3A!:!g; $link =~ s!%3F!?!g; $link =~ s!%3D!=!g; } print "$link\n"; __DATA__ the old way: httpd://www.example.com/stuff/this%20and%20that.pl?foo=bar the new way: httpd%3A%2F%2Fwww.example.com%2Fstuff%2Fthis%20and%20that.pl%3Ffoo%3Db +ar
Is the old encoding method available through another module? Should I subclass the new one to rebreak it? If I have to tell every character I do or don't want to escape, I might as well write my own...

YuckFoo

Comment on Where is URI::Escape::DWIM
Download Code
Re: Where is URI::Escape::DWIM
by Fletch (Chancellor) on Jun 10, 2008 at 20:01 UTC

    According to the docs uri_escape takes an optional second argument that's a string representing (as if in a regexp character class) what you do want escaped. Write a wrapper version once with your preferred escaping list and call that limited_escape( $blah ) instead.

    The cake is a lie.
    The cake is a lie.
    The cake is a lie.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2014-07-29 12:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (217 votes), past polls