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

Hello fellow monks,

we've been using LWP::Curl v0.5 on our server quite some time, without any problems. Since we're moving to a new server, I'm testing our code, and I can't get LWP::Curl to work. I keep getting following error:

Undefined subroutine &LWP::Curl::encode called at /usr/local/share/perl/5.10.0/LWP/Curl.pm line 211.

Since it worked in v0.05 but not in v0.06, I did a diff between the two versions and found only around 10 lines had changed. It seems a bit like a quick update, because he changed

our $VERSION = '0.06';

but he forgot to change this in the POD, as you can see on CPAN.

Another change is that he used to do
use HTML::Entities
but now instead does
use URI::Escape

Now HTML::Entities has a method "encode", but URI::Escape does not. This might be what is causing the error. URI::Escape does have a method uri_escape.

Since his changelog does not even include a date, leave alone what was changed or why, I can only use the file date as reference. It seems this version dates from january 2009, so I'd be suprised if I was the first to discover this bug.

What would be my best cause of action?
* Simply use module v0.05 on the new server, and don't ever update?
* Contact the author, file a bug report?
* Fix the bug (Curl.pm) myself?

Thanks for your input!

Replies are listed 'Best First'.
Re: Bug in LWP::Curl v0.6?
by mje (Curate) on Mar 09, 2011 at 14:53 UTC

    Report problems here. I note one you mentioned is already reported. Stick with working version until fixed. Better try and fix and send patch.

Re: Bug in LWP::Curl v0.6?
by lorn (Monk) on Mar 09, 2011 at 17:06 UTC

    Bug fixed, i just upload the new version of LWP-Curl to CPAN

    Thanks!

    Lindolfo 'Lorn' Rodrigues
    -http://lornlab.org
    -@lornlab - twitter

    I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction

Re: Bug in LWP::Curl v0.6?
by wind (Priest) on Mar 09, 2011 at 17:11 UTC

    Filing a bug report and using module v0.05 is probably your best action. However, you can also hack a solution:

    use LWP::Curl; require HTML::Entities; BEGIN { *LWP::Curl::encode = \&HTML::Entities::encode; }

    Or you can translate your code to one of the more commonly used LWP modules like LWP::Simple or LWP::UserAgent.

    .02

    Update: Nevermind, looks like the module author watches perlmonks ;)