I have been writing in VBScript for some time and am semi-new to Perl. I am in
the process of converting my vbscripts to Perl scripts.. I am not sure if
someone can help but for those familiar with VBScript what I would like to know
is if there is something similar to an On Error Resume Next statement in Perl.
I use this quite frequently to address errors while the code is executing and
to keep the script from exiting in the middle of execution.. For instance in
VBScript I can write...
' VBScript Example
On Error Resume Next
Do Until....
Function(parameters)
If Err.Number <> 0 Then
Wscript.Echo "Some Text That Tells Me an Error has Occurred"
On Error GoTo 0 'Clears Error so the code does not execute
unless it errors again
Else
Execute Code
End If
Loop
' End VBScript Example
Now I am familiar with the below and I think that I am on the right track but I
need some direction...
# Perl Example
use Win32::OLE;
$Win32::OLE::Warn = 3; # A number to either allow execution or cause the script
to die
While() {
$_;
}
# End Perl Example
With adjusting the $Win32::OLE::Warn parameter I can allow continued execution
of the code in case of error. The problem I am having is trapping the error and
clearing it afterward so that the code can notify me an error has occurred,
clear the error and allow execution of the code freely until the next error
occurs...
This is mainly used in control statements but I also use it in simple scripts
so I at least know something has eroded but the code is executing as expected.
Any help is appreciated....
Bryan
_______________________________________________
Perl-Win32-Admin mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs