Before calling $mech->submit_form it might be helpful to do things like:
$mech->dump_text; $mech->dump_forms; $mech->dump_headers; to see whether $mech really is getting the page you think it is. Andrew On Sat, Jan 31, 2015 at 2:04 PM, Mike <ekimduna...@gmail.com> wrote: > Hey everyone, I'm trying to submit a form with WWW::Mechanize to post a new > thread on a forum from the command line. The forum also requires an image to > be uploaded with it. Anyway...here is my snippet: > > $mech->submit_form( > form_name => 'post', > fields => { body => $text, file => $file_location }, > button => 'post' > ); > > When I run the code, I'm getting this error: > > Uncaught exception from user code: > There is no form named "post" at > /usr/share/perl5/site_perl/WWW/Mechanize.pm line 1938. > > But the HTML source code on the site shows that the form name IS indeed > "post": > > <form name="post" onsubmit="return dopost(this);" > enctype="multipart/form-data" action="/post.php" method="post"> > > Can anyone tell me why I'm receiving this error? > > Thanks. > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > > -- Andrew Solomon Mentor@Geekuni http://geekuni.com/ http://www.linkedin.com/in/asolomon -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/