$remote->waitfor(‘/Logoff/’);
I get error sometimes saying that pattern match timed out when server is unavailable. I want to handle this error. Whenever this error occurs i want to make my script sleep for 1 minute and try to re-login.
I have tryied something like this:
if($remote->waitfor('/Logoff/'))
{
#proceed login perform intended operations.
}
else
{
sleep(60);#control is not coming here. returning pattern match timed-out error.
}
The way most of “Net::Telnet” methods are handling errors is defined by the “errmode” options.
This include of course the
waitformethod and timeout errors.The default “errmode” behaviour is “die”, meaning that your
waitforcall will return nothing and go no-where.To have a value to check, you need to set the “errmode” to “return“:
NB: As you specify additional options to
waitfor, you need to set the match pattern through the “match” option.