I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2005-11-24 11:42:07-08 by jstenzel
Timing problem?
Hello,

when reading the fields of a form in a loop with code like this (with W32::IE::M 0.009 under XP with pxperl 5.8.7):

foreach my $field (@fields) { my $val=$ie->value($field); $ie->_wait_while_busy(); ... }

at a point W32::IE:M stops operation saying: "Can't call method "value" on an undefined value at C:/PXPerl/site/lib/Win32/IE/Form.pm line 232."

As this can be fixed by an extra delay with
foreach my $field (@fields) { sleep(1); my $val=$ie->value($field); $ie->_wait_while_busy(); ... }

I suppose it's time of a timing problem?

Thanks in advance

Jochen Stenzel
Direct Responses: 1402 | 1404 | Write a response
Posted on 2005-11-24 11:44:07-08 by jstenzel in response to 1401
Re: Timing problem?
The last part should read "... kind of a timing problem", of course. jstenzel
Direct Responses: Write a response
Posted on 2005-11-25 10:26:50-08 by abeltje in response to 1401
Re: Timing problem?
Hi Jochen,
First of all, could you try 0.009_17 from CPAN?
Second, there should be no need to call _wait_while_busy()!

I can't tell how you filled @fields, but I would write it as:
my @fields = $ie->current_form->inputs; for my $field ( @fields ) { my $val = $field->value; ... }
HTH,
-- Abe.
Direct Responses: 1854 | Write a response
Posted on 2006-02-26 11:18:42-08 by geoffmulhall in response to 1404
Re: Timing problem?
Hi, I've just installed vers 0.008 and I get a lot of "Can't call method "find_input" on an undefined value at .... mechanize.pm line 914" In one section of code I'm looping through a file retrieving the same form, extracting data using HTML::TableExtract. I have a sleep(1) inside the loop but ocassionally I get the error. One thing I've not been able to do is successfully login to a site. I ALWAYS get the error above. Any ideas how to overcome, BTW Win32-IE-Mechanize is great ! Geoff
Direct Responses: 2533 | Write a response
Posted on 2006-06-25 13:54:31-07 by erik in response to 1854
Re: Timing problem?
I have these problems too. I found the error occurs either when a page is not completely loaded or when there are several forms on a page and Mech does not know what form to adress. Would be nice to at least not have the error to brake the running of the script. I would prefer that it just logs the error and then continues with the next task. Overall I am not very happy with the wait_while_busy function.
Direct Responses: 2684 | Write a response
Posted on 2006-07-24 16:31:58-07 by robert in response to 2533
Re: Timing problem?
I use WIN32::OLE module. I found this small subroutine that waits for IE. If you are using IE, or have IE, then this might work for you. You can also just set visible to false and it would work almost like Mech does.
sub WaitForBusy { while ($IEbrowser->{Busy} == 1) { sleep(0.5); } }
Direct Responses: 3494 | Write a response
Posted on 2006-11-11 14:02:38-08 by erik in response to 2684
Re: Timing problem?
I tested but it does not help at all, still get those annoying error messages and interrupted executions.
Direct Responses: 3495 | Write a response
Posted on 2006-11-11 14:14:37-08 by erik in response to 3494
Re: Timing problem?
However this finally did it: while($ie->{agent}->Document->readyState !~ /complete/i){ sleep(0.5); }
Direct Responses: Write a response