Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Puzzling URI::Escape problem

by slugger415 (Scribe)
on Apr 02, 2012 at 22:04 UTC ( #963124=perlquestion: print w/ replies, xml ) Need Help??
slugger415 has asked for the wisdom of the Perl Monks concerning the following question:

Hello dear monks, a user of a script I've written that uses the URI::Escape module keeps getting an error:

Undefined subroutine &URI::Escape::uri_escape_utf8 called at myscript.pl line 375.

I cannot duplicate this error on my machine. I use it thusly:

use URI::Escape; ## lots of other stuff ## $booktitle = URI::Escape::uri_escape_utf8($booktitle);

I'd also used it like so, without the prefix:

$booktitle = uri_escape_utf8($booktitle);

Someone else reported a similar error with that syntax, and it was fixed when I added the URI::Escape prefix to the call.

We're both running ActivePerl, he 5.8 and I 5.12, does that make a difference? Is there something I'm missing?

thanks very much -- Scott

Comment on Puzzling URI::Escape problem
Select or Download Code
Replies are listed 'Best First'.
Re: Puzzling URI::Escape problem
by tobyink (Abbot) on Apr 02, 2012 at 22:15 UTC

    Very old version of URI::Escape? uri_escape_utf8 has been exported by default since version 1.36.

    It's easy enough to explicitly request it to be exported:

    use URI::Escape qw(uri_escape uri_escape_utf8);
    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
      Considering Perl 5.8 is ancient, the version of URI installed on that might not even have uri_escape_utf8. It was added in URI 1.31. You can explicitly require minimum module versions like so: use URI 1.36;

      Yes it looks like the ancient Perl was the culprit. Thanks for the quick responses!

        Yes it looks like the ancient Perl was the culprit. Thanks for the quick responses!

        :) Considering URI doesn't come with Perl, its available on CPAN, the ancient version of URI was the culprit

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (9)
As of 2015-07-29 22:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls