#!perl use strict; use warnings; use Win32::OLE qw/EVENTS/; use Win32::OLE::Variant; my $ie = Win32::OLE->CreateObject('InternetExplorer.Application', 'Quit') or die "Can't start IE", Win32::OLE::LastError(); $ie->{Visible} = 1; $|++; Win32::OLE->WithEvents($ie, 'main', 'DWebBrowserEvents2'); $ie->GoHome; Win32::OLE->MessageLoop(); sub NewWindow2 { my ($self, $browser, $cancel) = @_; $cancel->Put(1); print "$self->{LocationURL} tried to open a new window!\n"; } sub OnQuit { Win32::OLE->QuitMessageLoop; }