CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner: Re: [frist44] How to handle failure of sub procedures?: Edit Log



KevinR
Veteran


Jan 8, 2009, 1:37 PM


Views: 5479
Re: [frist44] How to handle failure of sub procedures?


In Reply To
Ideally, I would like to have it run the sendEmail sub, and if successful, write:

Email sent successfully

If not successful, write:

Unable to send email

Can you point me in the right direction?


Something like this looks like it should work. Test it out.


Code
if (ping($device_address)){  
print SFILE "$device_address is alive.\n\n";
}
else {
print SFILE "$device_address is DEAD!!! --> ";
if (sendEmail($email, $email_smtp, $device_address) {
print SFILE "Email sent successfully\n\n";
}
else {
print SFILE "Unable to send email.\n\n";
}
}

-------------------------------------------------


(This post was edited by KevinR on Jan 8, 2009, 1:38 PM)


Edit Log:
Post edited by KevinR (Veteran) on Jan 8, 2009, 1:38 PM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives