After looking at the (5.8.8) source code, I'd have to say that in your case I would first insure that I was using a valid form number. Then I would check your "fields" hash to make sure it is good. It looks like it expects a hash. Your best bet would be to look at line 1492 of /usr/lib/perl5/site_perl/5.8.5/WWW/Mechanize.pm on your computer.

From Mechanize.pm (5.8.8): Notice the "or die" code.

sub submit_form { my( $self, %args ) = @_ ; for ( keys %args ) { if ( !/^(form_(number|name)|fields|button|x|y)$/ ) { $self->warn( qq{Unknown submit_form parameter "$_"} ); } } if ( my $form_number = $args{'form_number'} ) { $self->form_number( $form_number ) or die; } elsif ( my $form_name = $args{'form_name'} ) { $self->form_name( $form_name ) or die; } if ( my $fields = $args{'fields'} ) { if ( isa( $fields, 'HASH' ) ) { $self->set_fields( %{$fields} ) ; } # TODO: What if it's not a hash? We just ignore it silently +? } my $response; if ( $args{button} ) { $response = $self->click( $args{button}, $args{x} || 0, $args{ +y} || 0 ); }

In reply to Re: how to get useful errors with WWW::Mechanize by MonkE
in thread how to get useful errors with WWW::Mechanize by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.