chinman has asked for the wisdom of the Perl Monks concerning the following question:
I have a little subroutine that refreshes a IE browser window as shown below. Sometimes I find that internet explorer is out to lunch and this sub hangs my program. Is there anyway to trap this error and give up for example, e.g., by using eval or something.
Thanks,##subroutine that displays a file in IE browser window ##only works if a browser is running sub display_browser { my $file = shift; ## convert backslashes to forward slashes in the file path $file =~ s!\\!/!g; if ( $^O eq "MSWin32" and "$file" and -e "$file" ) { use Win32::OLE; ## test to see if internet explorer is already running my $ie = Win32::OLE->GetActiveObject("InternetExplorer.Applica +tion"); if ( defined $ie ) { $ie->{Visible} = 1; $ie->Navigate("$file"); } } }
|
|---|