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

I have installed the perl module WWW:Mechanize in my machine. The machine contains RHEL 4. And when i ran a program like the following one:
use strict; use WWW::Mechanize; use HTTP::Cookies; use HTTP::Request::Common; use HTTP::Response; use LWP::Debug qw(+); ####################### ####Variables $username, etc ######################## my $mech = WWW::Mechanize->new(); $mech->cookie_jar(HTTP::Cookies->new()); # post login $mech->get($url); $mech->form_name('Form1'); $mech->field('txtUserID' => $username); $mech->field('txtPassword' => $password); #$mech->field('btnSubmit' => 'Submit'); my $response=$mech->click('btnSubmit');
I got the following error when i used the Debug mod for LWP.
LWP::UserAgent::new: () LWP::UserAgent::request: () LWP::UserAgent::send_request: GET https://www.abc.com/default.aspx LWP::UserAgent::_need_proxy: Not proxied LWP::Protocol::http::request: () LWP::Protocol::collect: read 739 bytes LWP::Protocol::collect: read 4096 bytes LWP::Protocol::collect: read 4096 bytes LWP::Protocol::collect: read 4096 bytes LWP::Protocol::collect: read 2281 bytes HTTP::Cookies::extract_cookies: Set cookie ASP.NET_SessionId => 0rjco5 +45pbrr3gbwmsi5ndjy LWP::UserAgent::request: Simple response: OK Can't locate object method "decoded_content" via package "HTTP::Header +s" at (eval 16) line 1
But, When i removed the line decoded_content() from the Mechanize.pm module in my system, i got the correct response. Since it is not correct to modify the modules in CPAN for specific use, can you suggest me some ways of how to overcome this error or how i can rectify this?

Replies are listed 'Best First'.
Re: Problem with the module WWW::Mechanize
by Corion (Patriarch) on Jul 20, 2007 at 07:44 UTC

    This is weird - the Makefile.PL for WWW::Mechanize specifies LWP version 5.802, and HTTP::Message has the ->decoded_content method at least since LWP release 5.802 (HTTP::Message version 1.52).

    How did you install WWW::Mechanize? If you did a manual install or maybe forced the installation, you maybe skipped the LWP dependency. Check your version of HTTP::Message with the following:

    perl -MHTTP::Message -e 'print $HTTP::Message::VERSION'

    and if it's lower than 1.52, you need to upgrade your HTTP::Message module. If the module is the current version then please report the versions of all modules involved (WWW::Mechanize, LWP::UserAgent, HTTP::Message, ...)

      Thanks Friend. Can we upload a file using the Web::Mechanize module? is there any function as such? I want to upload a file using the fileupload box in a page. please help me if you know
Re: Problem with the module WWW::Mechanize
by ForgotPasswordAgain (Vicar) on Jul 20, 2007 at 07:46 UTC
    Try updating LWP.