Sleeping with WWW::Mechanize
2006/05/08 filed under /perlI have recommended WWW::Mechanize to every Perl scripter I know already, for it's one of the Perl modules I like best. It saves you so much time!
Today I ran into a minor problem with it though. The annoying form "I" had to fill out was using JavaScript to create some needed variables, resulting in a few "No such field 'name' at /blah/WWW/Mechanize.pm".
After some searching, I ran into an interesting thread where Gisle Aas explains a little about the undocumented push_input method of HTML::Form.
So, of course, I used that hack, but I'd still didn't get the results I was looking for. Looking at CPAN for some WWW::Mechanize plugins, I ran into WWW::Mechanize::Sleepy again. I've seen it before and the thought of delaying my input sounded test worthy. And yeah! It was the solution! It turned out the host was not accepting input when the form was submitted in less than 4 seconds after requesting the actual form.
Remember this! It might come in handy when you're banging your head against the wall over WWW::Mechanize scripts ;)


