<?xml version="1.0" encoding="windows-1252"?>
<node id="1017904" title="help with WWW::Mechanize" created="2013-02-08 18:26:36" updated="2013-02-08 18:26:36">
<type id="115">
perlquestion</type>
<author id="1017900">
waoverholt</author>
<data>
<field name="doctext">
&lt;p&gt; 
Hello Monks, 
&lt;/p&gt;

&lt;p&gt; 
I am a relatively new perl user (still very much the beginner) and I am working on a script to interface with a website (http://linux1.softberry.com/berry.phtml?topic=fgenesb&amp;group=programs&amp;subgroup=gfindb).
&lt;/p&gt;

&lt;p&gt; 
Essentially I would like to upload a local file to that form, select a different "closest organism", hit "Process", and then download the resulting textfile to my computer. 
&lt;/p&gt;

&lt;p&gt; 
Running the code:
&lt;/p&gt; 
&lt;c&gt; $mech-&gt;dump_forms(); 
&lt;/c&gt;

&lt;p&gt; 
seems to work at finding those forms but I'm not quite sure how to navigate the fields. Here is what I have so far. Obviously incomplete for the task, but even the first checks fail. 
&lt;/p&gt;

&lt;p&gt;
Thanks for taking the time to read this and any advice would be greatly appreciated.
&lt;/p&gt;

&lt;p&gt;
- waoverholt
&lt;/p&gt;

&lt;c&gt; 
use warnings;
use strict;
use WWW::Mechanize;


my $genome_file = $ARGV[0];


my $agent = WWW::Mechanize-&gt;new();
my $url = "http://linux1.softberry.com/berry.phtml?topic=fgenesb&amp;group=programs&amp;subgroup=gfindb";
my $results = $agent-&gt;get($url);
die "GET failed" unless $results-&gt;is_success;

#$agent-&gt;dump_forms();

my $form1 = $agent-&gt;form_name("FILE"); die unless $form1-&gt;success;
my $form1_info = $agent-&gt;field("FILE", $genome_file); die unless $form1_info-&gt;is_success;
$agent-&gt;select();



$agent-&gt;form_name('org');
$agent-&gt;field("option", "ARCHAE BACTERIAL generic");
$agent-&gt;click();

$agent-&gt;form_name('Process');

&lt;/c&gt;</field>
</data>
</node>
