puff has asked for the wisdom of the Perl Monks concerning the following question:
With this code in place, the test program runs OK. However, it raises the question of how to handle the child's events re child completion and other potential IE Mech issues. It appears that I can examine the event's agent parameter to tell which IE the event came from (I'm not really sure about this, I'd appreciate any cluse). So I tried to use the same event handler per the code that is commented out. When I do this, the print statements generate output that looks like two events overwriting each other. It appears that the event routine may have been reentered! I've considered a separate event handler for the child window but ultimately, that is not attractive since a parent may have many children who may have many children and so on. I suppose I might be able to do something with anonymous handlers. However, I attack this issue, it seems to me that there are issues of multiple OLE event streams to perl that need to be dealt with.sub win32_ie_events { my( $agent, $event, @args ) = @_; $events_ok++ or init_win32_ie_events(); $t_last_event = gettimeofday(); CASE: { # NON RELEVANT CODE DELETED $event eq 'NewWindow3' and do { my $pu = Win32::OLE->new('InternetExplorer.Application')-> +{Application}; #Win32::OLE->WithEvents( $pu, \&win32_ie_events, 'DWebBrow +serEvents2' ); $args[0]->Put($pu); } } my $te = sprintf '%6.2f', $t_last_event - $t_start; print "$te $agent $dl_cnt $dl_tot [$event]\n"; }
|
|---|