in reply to WWW::Mechanize and unnamed images

You need to learn more about HTML (check out HTML Help which is a great page about HTML tags).

Looking at your HTML it is clear that your form has an action (<form .. action=".." ..>). That action specifies what web page WWW::Mechanize should fetch when you submit the form.

Now looking at your image (<input type="image"...) it is clear that this image is not designed to actually perform any function by itself. It is likely that a javascript function elsewhere has tied itself to this image to make it clickable. Whatever that may be, the important information is already encoded in the form (the action as I mentioned earlier).

So just try this code instead while paying particular attention to the <form ...> tag:

use WWW::Mechanize; use strict; my $agent = WWW::Mechanize->new(); $agent->get('http://address'); $agent->form_name('form1'); $agent->field('request', 'test'); $agent->submit(); # will go to the form's action URL print( $agent->response->content() );

Replies are listed 'Best First'.
Re^2: WWW::Mechanize and unnamed images
by davidrw (Prior) on Mar 02, 2006 at 14:36 UTC
    Now looking at your image (<input type="image"...) it is clear that this image is not designed to actually perform any function by itself. It is likely that a javascript function elsewhere has tied itself to this image to make it clickable.
    No, <input type="image"> behaves the same as <input type="submit">, just instead of being a plain button w/text, it's whatever image you specify. So it does perform a function (submit form) by itself -- no javascript is involved. Note it also submits the coordinates of the image that were clicked, too.

    The HTML Help page is here: INPUT - Form Input (search for "graphical submit" to get to the right place in the page)