Sod's law folks. Posted the question then reviewed what I'd done and found the problem. Mixing three examples gave me the wrong code. Lifted the line straight from the HTML::Form perldoc and it worked.
$req=$ua->request($form->click); Gary On Tuesday 30 March 2010 09:41:54 Gary Stainburn wrote: > Hi folks, > > I'm trying to write my first proper app using the above modules but > following the perldocs/cookbooks I've come to a quick dead stop. > > According to the perldoc $form->click should generate an object I can pass > straight to $ua->post, but when I try that I get the following: > > Code snippet: > > my $form=shift(@forms); > my @inputs=$form->inputs; > > for (my $i=0; $i<$#inputs;$i++) { > my $inp=$inputs[$i]; > my $type=$inp->type; > my $name=$inp->name; > my $value=$inp->value; > print "type='$type' name='$name' value='$value'\n"; > } > > $URL=$form->action; > $form->value('userid','gary'); > $form->value('pw','secret'); > $form->value('submit','Continue'); > > print "action=$URL\n"; > $req=$ua->post($URL,$form->click); # this is line 82 > > Output: > > type='text' name='usersid' value='' > type='password' name='pw' value='' > type='submit' name='submit' value='Continue' > type='hidden' name='fromHome' value='true' > action=http://test.ringways.co.uk/formtest.html > Not an ARRAY reference > at /usr/lib/perl5/vendor_perl/5.10.0/HTTP/Request/Common.pm line 82. > > Any ideas what I'm doing wrong? > > > -- > Gary Stainburn > > This email does not contain private or confidential material as it > may be snooped on by interested government parties for unknown > and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 -- Gary Stainburn This email does not contain private or confidential material as it may be snooped on by interested government parties for unknown and undisclosed purposes - Regulation of Investigatory Powers Act, 2000 -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/