if (&whatever was successful) {

They have: 314 posts

Joined: Nov 1999

Is there anyway to check to see if an action ws performed and was actually successful?

Ken Elliott's picture

They have: 358 posts

Joined: Jun 1999

They have: 99 posts

Joined: May 1999

Please give specific example....

If what you are referring to is whether a called function was successfull, then you are simply checking the return value which you can arbitrarily set during the function. And, yes, this will work for the conditional portion of an if statement...

Sorry, if this is not what you are referring to, please give more details.

Tazman

[Edited by tazman on 07-15-2000 at 01:57 PM]

They have: 314 posts

Joined: Nov 1999

An example is:
open sendmail and send a message to the specific recipients. If all goes well then print something and if it doesnt go well, IE, there was an error or, like I have experienced, it simply does not work even though there is no error, then posts something else.

I hopwe this helps

They have: 99 posts

Joined: May 1999

Yep...that helps.

Specifically for your example, I use Mail::Sendmail package, this package allows you to define the standard email parameters, recipients, content, smtp server, etc.

example:
($success_flag)=&send_email($to,$from,$sub,$body);

&send_email(){

local($to_address,$from_address,$subject,$body) = @_;
%mail = (To=> $to_address,
From=> $from_address,
Subject=> $subject,
Message=> $body);
$success_flag=1;
sendmail (%mail) or $success_flag=0;
return ($success_flag);

}

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.