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

Hey!How can i find the name of the form that's processing a login made with WWW::Mechanize . Let's consider the following example :

my $x=WWW::Mechanize->new(); $x->get("www.somesite.com"); $x->field("user_field","username"); $x->password("password_field","password"); $x->click();
How can i find out where exactly my script sends its data ?

Replies are listed 'Best First'.
Re: WWW::Mechanize form
by Fletch (Bishop) on Nov 16, 2006 at 12:59 UTC

    The forms method returns a list (or an arrayref in scalar context) of HTML::Form instances for each form in the page. Alternately you can use form_number or form_name to retrieve a specific form. You can call the action method on these instances to retrieve the URI.

Re: WWW::Mechanize form
by wfsp (Abbot) on Nov 16, 2006 at 11:06 UTC
    One way might be to use WWW::Mechs content method to get the html and to then use an html parser to examine the forms action attribute.
Re: WWW::Mechanize form
by Anonymous Monk on Nov 17, 2006 at 10:14 UTC