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

Reply via email to