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

Esteemed Monks,

I am trying to scrape a site using WWW::Mechanize. Somehow, I am not managing to submit a very simply form containing radio buttons. I hope you can help! This is the form code from the page source:
<form method="post" action="http://..."> <div class="ABC"> <div class="DEF"><input type="radio" name="Radio" id="1" value="1" />< +label for="1">Option1</label></div> <div class="DEF"><input type="radio" name="Radio" id="2" value="2" />< +label for="2">Option2</label></div> <div class="DEF"><input type="radio" name="Radio" id="3" value="3" />< +label for="3">Option3</label></div> </div> <div class="buttons"> <div class="spacer"></div> <input type="submit" class="form_buttons" name="submit" value="Submit +Form" /> <div class="form_buttons"><a href="http://..." title="...">...</a></di +v> <input type="hidden" name="ID" value="Form_ID" /> <div class="spacer"></div> </div> </form>

And this is how I tried to submit the form:
#!/usr/bin/perl -w use strict; use WWW::Mechanize; use Crypt::SSLeay; use HTTP::Cookies; my $agent = WWW::Mechanize->new(); my $cookie_file = "Cookies.txt"; $agent -> cookie_jar( HTTP::Cookies->new( File => $cookie_file, autosa +ve => 1 )); my $page = 'http://...'; # Request the page. $agent -> get( $page ); # Set the radiobutton 'Radio' to the second option. $agent -> set_fields( 'Radio' => '2' ); # Now post the poll form to the URL given in the source code under act +ion="http://...". $agent -> post( 'http://...' );

Thanks for your help with this in advance!
Cheers -