event handling and then iterate through a collection of IE browser objects:
my $objectCollection = $document->All();
foreach my $object( in $objectCollection ) { # Blah, blah }
I get the "Bizarre copy of HASH in push" exception.
However, if I iterate differently,
my $objectCollection = $document->All();
my $numberOfObjects = $objectCollection->{length};
foreach my $i( 0 .. ($numberOfObjects-1) ) { # Blah, blah }
I do not get an exception.
How do I alert the powers that be about this potential defect?
Andrew McFarlane
From: "Steven Manross" <[EMAIL PROTECTED]>
To: "Kevin Carothers" <[EMAIL PROTECTED]>,"Andrew McFarlane" <[EMAIL PROTECTED]>
CC: <perl-win32-users@listserv.ActiveState.com>
Subject: RE: Win32::OLE : Bizarre Push while Examining IE Events
Date: Wed, 23 Feb 2005 07:08:52 -0700
I use events with IE automation.
use Win32::OLE qw(EVENTS)
Then check the Win32::OLE docs or the archive lists to see how to use them.
Steven
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Carothers Sent: Tuesday, February 22, 2005 4:21 PM To: Andrew McFarlane Cc: perl-win32-users@listserv.ActiveState.com Subject: Re: Win32::OLE : Bizarre Push while Examining IE Events
Hi Andrew,
I really don't know what's going on, but I have tried running MSAccess as an OLE automation server; you too are obviously running IE as an OLE automation server.
I hate it when people tell me something can't be done, but I really doubt that you can call events from a COM object via a perl script... It MAY be possible from a VB program, because (I believe this is how it works) both are bound at runtime via the VB6RT.DLL... but I may be wrong... if you findan answer to this, PLEASE POST!!!!
I worked on a similar project a few weeks ago- I had to implement a report server in Perl to run MS Access reports and deliver the snapshot (*.snp) to the browser- I discovered that I could not run an OLE method - $access->DoCmd->RunReport() got an error; "You cannot run this method at this time"
"this time" was a code-phrase for "you cannot run this method at ANY time [:-)]
I was able to solve my problem by writing a VB program that "bridged" my OLE automation request from the Perl script, and notified the script via some pretty clunky means that I'm too embarassed to get into here.
HTH
KC
On Sun, 20 Feb 2005 10:09:13 -0700, Andrew McFarlane <[EMAIL PROTECTED]> wrote: > I need help in figuring out how to prevent an exception from occurring when > I try to examine Internet Explorer browser events using Win32::OLE. Thanks > in advance for your help. > > I have a library that allows one to drive Internet Explorer. My code runs > well until I try to examine the window events by using the Win32::OLE > WithEvents method. When I uncomment the line of code that sets the event > handler, I get the error message: > > Bizarre copy of HASH in push at C:/Perl/site/lib/Win32/OLE/Lite.pm line 168 > (#2) > > (P) Perl detected an attempt to copy an internal value that is not > copyable. > > Uncaught exception from user code: > Bizarre copy of HASH in push at C:/Perl/site/lib/Win32/OLE/Lite.pm > line > 168. > > Line 168 of OLE::Lite is inside of the "in" method definition--I call that > method when I'm iterating through a collection of Win32::OLE IE objects. > > Here's a snippet of code: > > I initialize a browser and set the browser event handler: > > # Launch Internet Explorer. > $oleBrowserRef = Win32::OLE->new("InternetExplorer.Application") > or croak "${CLASS}::new Could not open an Internet Explorer browser: > ",Win32::OLE->LastError(),"\n"; > > # Register window events. > Win32::OLE->WithEvents($oleBrowserRef, \&browserEventHandler, > "DWebBrowserEvents2"); > > Here is the browser event handler: > > sub browserEventHandler { > my ($browser,$event,@args) = @_; > > my $URL = $browser->{URL}; > > if( $DEBUG ) { > > print "DEBUG: ${CLASS}::browserEventHandler: Event: $event "; > > foreach my $arg (@args) { > my $value = $arg; > $value = sprintf "[%s %s]", > Win32::OLE->QueryObjectType($value) > if UNIVERSAL::isa($value, 'Win32::OLE'); > print "\targ: $value\n"; > } > print "\n"; > > } > > 1; > } > > Thanks for your help. > > Andrew McFarlane > > _______________________________________________ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
_______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs