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

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 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

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?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://963124]
Approved by ww
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2018-05-23 02:18 GMT
Find Nodes?
    Voting Booth?