I tried to insert some debugging code between the $mech->get() and $mech->select() lines, as following:
my $f = 0; for my $form ($mech->forms) { printf "Find form #%d: %s\n", ++$f, $form->attr('name'); my $i = 0; for my $input ($form->inputs) { printf "Input #%d: %s (type: %s), values: [%s]\n", ++$i, $input->name, $input->type, join(', ', $input->possible_values); } }
I also add a debugging line after the $mech->select() line to print the value set for the field ("S. cerevisiae").
print 'Selected species: ', $mech->value('species'), "\n";

When I run it, I got this result:

Find form #1: paramForm Input #1: paramFile (type: hidden), values: [] Input #2: upstream (type: hidden), values: [] Input #3: runBeam (type: hidden), values: [] Input #4: runAmbiguizer (type: hidden), values: [] Input #5: runBipartites (type: hidden), values: [] Input #6: upstreamType (type: radio), values: [intergenic, fixed] Input #7: group (type: textarea), values: [] Input #8: groupFile (type: file), values: [] Input #9: emailAddress (type: text), values: [] Input #10: emailSubject (type: text), values: [] Input #11: selectParamsButton (type: submit), values: [] Input "species" not found at monkfan.pl line 31 No such field 'species' at /usr/lib/perl5/site_perl/5.8.8/WWW/Mechaniz +e.pm line 1324
Somehow the 'species' field isn't found and an error is issued instead. There are 11 fields. I can't figure out why the 'species' field isn't recognized. I think there's something went along the way to the remote server. So I download the html code and put it on my local web server. What I get is even more suprising, increasing my curiosity level:
Find form #1: paramForm Input #1: paramFile (type: hidden), values: [] Input #2: upstream (type: hidden), values: [] Input #3: runBeam (type: hidden), values: [] Input #4: runAmbiguizer (type: hidden), values: [] Input #5: runBipartites (type: hidden), values: [] Input #6: species (type: option), values: [init, A. fumigatus Af293, A +. gossypii, A. nidulans, A. thaliana, A. tumefaciens C58, B. subtilis +, C. elegans, C. tetani E88, C. trachomatis, Candida albicans, Candid +a glubrata, Candida lusitaniae, Candida tropicalis, Cryptococcus neof +ormans, D. melanogaster, D. rerio, E. coli K12-MG1655, Fusarium verti +cillioides, H. influenzae, H. pylori, H. sapiens, Histoplasma capsula +tum, Kluyveromyces lactis, M. jannaschii, M. tuberculosis CDC1551, M. + tuberculosis H37Rv, Magnaporthe grisea, N. crassa, Neurospora crassa +#2, P. aeruginosa PA01, P. falciparum 3D7, R. norvegicus, Rhizopus or +yzae, S. aureus MW2, S. cerevisiae, S. pombe, S. typhimurium LT2 SGSC +1412, V. cholerae El Tor N16961, Y. pestis CO92, Yarrowia lipolytica] Input #7: upstreamType (type: radio), values: [intergenic, fixed] Input #8: group (type: textarea), values: [] Input #9: groupFile (type: file), values: [] Input #10: emailAddress (type: text), values: [] Input #11: emailSubject (type: text), values: [] Input #12: selectParamsButton (type: submit), values: [] Selected species: S. cerevisiae

First, there are 12 fields. Second, the 'species' field is there at #6 (as type 'option') along with the possible values for the select. Third, the selected option is confirmed, and it's "S. cerevisiae".

Frankly, I haven't find anything why the difference. I'm not even sure whether this has something to do with the internal of WWW::Mechanize although I tend to think "no".


Open source softwares? Share and enjoy. Make profit from them if you can. Yet, share and enjoy!


In reply to Re: Problem with WWW::Mechanize 'select' method by naikonta
in thread Problem with WWW::Mechanize 'select' method 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.