in reply to WWW::Mechanize and submit button question

Hi,

try something like this:
#!/usr/bin/perl use WWW::Mechanize; # URL for primer3 my $url = 'http://frodo.wi.mit.edu/cgi-bin/primer3/primer3_www.cgi'; my $mech = WWW::Mechanize->new(); $mech->get($url); $sequence='ACAGCNTCTGTTGACTCCCCTGCCAGCAAGCCCACTGGCCTGAGCACATGAAGTCCTGC +ACCCAGTCAGGAGAAGGAGCGCTCCTGGCACCAGCAGGAGCTGGCAAAGGCTCTGGAGAGCTTAGAAAG +GGAAAAAATGGAGCTGGAAATGAGGCTAAAGGAGCAGCAGACAGAAATGGAGGCCATCCAGGCCCAGAG +GGAAGAAGAACGGACCCAGGCAGAGAGTGCCCTATGCCAGATGCAGCTGGAAACAGAGAAGGAGAGAGT +ATCCCTCCTGGAGACACTGCTGCAGACGCAGAAGGAGCTAGCAGATGCCAGCCAACAACTGGACGGAAC +TGAGGCAA'; $primernum='1'; $mech->submit_form( form_number => 1, fields => { SEQUENCE => $sequence, PRIMER_NUM_RETURN => $primernum, } ); # and so fourth...
This code is untested as I dont have internet access from a machine running perl at the moment.
The documentation for WWW::Mechanize .
Let me how that turns out.

Martin

Replies are listed 'Best First'.
Re^2: WWW::Mechanize and submit button question
by srdst13 (Pilgrim) on Aug 08, 2005 at 13:22 UTC
    Martin,

    Thanks for the reply. However, I get the same response using both sets of code. I think the code you posted and mine are functionally the same, if my reading of the docs is correct, except that submit_form does not click a button for the form submission. Since the CGI is looking for the submit button parameter to be present and true, I think I need the "click" method there.

    Sean
      Hi Sean,

      Sorry that didnt work.
      Try using the following to submit the form rather than the method I suggested:
      $mech->submit();
      From the docs: "Submits the page, without specifying a button to click. Actually, no button is clicked at all."
      I think that using your code you posted and the $mech->submit(); rather than the $mech->click(); method may help.

      Thanks.

      Martin