in reply to Re^3: www::mechanize: second "submit" invisible to find_all_submits
in thread www::mechanize: second "submit" invisible to find_all_submits

... encouraged ... discouraged ...

Remember www::mechanize: second "submit" invisible to find_all_submits? What is action? You're knocking a the wrong door, the door you want is ...hypermut.cgi

Additional html related wisdom at markup validation

  • Comment on Re^4: www::mechanize: second "submit" invisible to find_all_submits

Replies are listed 'Best First'.
Re^5: www::mechanize: second "submit" invisible to find_all_submits
by wfischer (Novice) on Dec 09, 2014 at 17:31 UTC
    Correct, thanks -- using the cgi url (not coincidentally, mech-dump shows it in the POST list) gets an appropriate page back. Unfortunately, it says "Sorry! no sequence input." So I'm still not getting the sequences uploaded -- I'll update if I do get it to go.

      The final key here was that the second argument to the post method needed to be an array ref (i.e., the hash arguments needed to be enclosed in []s). The code below works, returning the desired output page in the $mech object.

      #!/usr/bin/perl use warnings; use strict; use WWW::Mechanize; my $hypermutUrl = "http://http://hiv-dev.lanl.gov/cgi-bin/HYPERMUT/hypermut.cgi"; my $mech = WWW::Mechanize->new( autocheck => 1 ); my $alignment_as_string = <<'END_SEQS'; >HIV1-test.CONS ATGGGATGTCTTGGGAATCAGCTGCTTATCGCGCTCTTGCTAGTAAGTGCTTTAGAGATTTATTGTGTTC >HIV1-test.1 ATGGAATGTCTTGGAAATCAGCTGCTTATCGCGCTCTTGCTAGTAAGTGCTTTAAAGATTTATTGTGTTC >HIV1-test.2 ATGGAATGTCTTGGGAATCAGCTGCTTATCGCGCTCTTGCTAGTAAGTGCTTTAAAGATTTATTGTGTTC END_SEQS $mech->post( $hypermutUrl, [ 'FORMAT' => 'FASTA', 'ALIGNMENT' => $alignment_as_string, 'upfile1' => '', 'INN' => '', 'OUT' => '', 'MUTUPSTREAM' => '', 'MUTFROM' => 'G', 'MUTTO' => 'A', 'MUTDOWNSTREAM' => 'RD', 'ENFORCE' => 'DESCENDANT', 'CONTROLUPSTREAM' => '', 'CONTROLFROM' => 'G', 'CONTROLTO' => 'A', 'CONTROLDOWNSTREAM' => 'YN|RC', 'Analysis' => 'All', 'submit' => 'Run', ] ); my $page = $mech->content; open my $FH, ">/tmp/hypermut.html"; print {$FH} $page; close $FH; warn "saved webpage data to /tmp/hypermut.html\n";

      Thanks to any and all who thought about it, and most particularly to my colleague who found my error.