On this website. I am attempting to do these two steps:

But how come the following script I have doesn't do the job? Especially the "click_button" method.
use WWW::Mechanize; my $mech = WWW::Mechanize->new(); my $tf_add = "http://rulai.cshl.edu/cgi-bin/SCPD/getgene2?ARG1"; $mech->get($tf_add); $mech->set_fields( 'start' => -450, 'end' => 50 ); # this part works # but not this: $mech->click_button( name => "action", value => "Retrieve sequence" ); $mech->submit(); my $result = $mech->content(); print "$result\n";
The snippet of the HTML structure in the related website can be found here :
<html><title>ARG1</title> <body bgcolor=white> <h2 align=center>ARG1</h2><hr> <form method="post" action="/cgi-bin/SCPD/getgene2?ARG1" enctype="appl +ication/x-www-form-urlencoded"> <input type="submit" name="action" value="Get mapped sites" /><input t +ype="submit" name="action" value="Get putative sites" /><input type=" +submit" name="action" value="Get intergenic region" /><br /><input ty +pe="submit" name="action" value="Retrieve sequence" />Start<-ATG <inp +ut type="text" name="start" value="-500" size="5" maxlength="5" />ATG +->End <input type="text" name="end" value="50" size="5" maxlength="5" + /><div></div></form><hr> <pre> ORF YOL058W GENE ARG1 XX FACTOR <a href= "getfactor?ARC">ARC</a> COORDINATE (-269, -247) SEQUENCE CATTTAAAGGCAGGAGAGAGAGA REFERENCE Yeast 1995, 11:1367-1380 .... skip some entries... </pre>
And the desired final output looks like this (by hand clicking).
<html><title>ARG1</title> <body bgcolor=white> <h2 align=center>ARG1</h2><hr> <form method="post" action="/cgi-bin/SCPD/getgene2?ARG1" enctype="appl +ication/x-www-form-urlencoded"> <input type="submit" name="action" value="Get mapped sites" /><input t +ype="submit" name="action" value="Get putative sites" /><input type=" +submit" name="action" value="Get intergenic region" /><br /><input ty +pe="submit" name="action" value="Retrieve sequence" />Start<-ATG <inp +ut type="text" name="start" value="-450" size="5" maxlength="5" />ATG +->End <input type="text" name="end" value="50" size="5" maxlength="5" + /><div></div></form><hr> <pre> >YOL058W ARG1 218759 219259 CGAGCTTTTTCACTGCAGTAATTCTCCACATGGGCCCAGCCACTGAGATA AGAGCGCTATGTTAGTCACTACTGACGGCTCTCCAGTCATTTATGTGATT TTTTAGTGACTCATGTCGCATTTGGCCCGTTTTTTTCCGCTGTCGCAACC TATTTCCATTAACGGTGCCGTATGGAAGAGTCATTTAAAGGCAGGAGAGA GAGATTACTCATCTTCATTGGATCAGATTGATGACTGCGTACGGCAGATA GTGTAATCTGAGCAGTTGCGAGACCCAGACTGGCACTGTCTCAATAGTAT ATTAATGGGCATACATTCGTACTCCCTTGTTCTTGCCCACAGTTCTCTCT CTCTTTACTTCTTGTATCTTGTCTCCCCATTGTGCAGCGATAAGGAACAT TGTTCTAATATACACGGATACAAAAGAAATACACATAATTGCATAAAATA ATGTCTAAGGGAAAAGTTTGTTTGGCTTATTCTGGTGGTTTAGATACCTC
Finally I would just like to extract the DNA sequence after <pre> tag above, starting from ">".

Regards,
Edward

In reply to Click button not working in WWW::Mechanize by monkfan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.