views:

29

answers:

1

I'm using the submit_form function in WWW::Mechanize as follows:

eval{
    my $me = $mechanize->submit_form( form_id => 'signin', 
    fields => { 
        login => 'abc', 
        password => 'def'} );
    $me->is_success or die $me->status_line;
};

Although this throws the error of Unknown submit_form parameter "form_id" it still retrieves the page. Why is this throwing this error?

+2  A: 

Which version of WWW::Mechanize are you using? (print "$WWW::Mechanize::VERSION\n";)

Older versions (e.g. 1.50 from 2008 or even 1.54 from Jan 2009) didn't support form_id parameter.

It was first introduced in 1.55_01 developer release or 1.56 stable release of WWW::Mechanize (you can easily see that if you brows through the first line (which validates parameter names) of submit_form() method in various versions of WWW::Mechanize on CPAN.

To update, it depends what your installation is (Unix? Windows? Centrally installed?) but the usual way is to use CPAN's "cpan" wrapper. You can search StackOverflow for CPAN install questions and ask your own if nothing matches your situaton.

DVK
How do i check the version?
Rajesh
Thats what it is...i have 1.32..how do i update?
Rajesh
@Rajesh: type `perldoc -q cpan`.
Ether