David,
Thank you for useful info!
But as I can see this approach won't catch the problem
if the incorrect email was specified.... ?
Thank you!
--- David T-G <[EMAIL PROTECTED]>
wrote:
> Leon --
>
> ...and then lz said...
> %
> % Hi guys,
>
> Hello!
>
>
> %
> % I have the following line:
> % system("cat $FILENAME | mailx -s \"test\"
> $mailAddress
> % ");
> %
> % How can I check whether mailx operation above was
> % successful or not?
>
> Just check the exit code. A quick
>
> perldoc -f system
>
> tells us that
>
> ...
> The return value is the exit status of the program
> as returned by the "wait" call. To get the actual
> exit value divide by 256. See also the exec entry
> elsewhere in this document. This is not what you
> want to use to capture the output from a command,
> for that you should use merely backticks or
> "qx//", as described in the section on "`STRING`"
> in the perlop manpage. Return value of -1
> indicates a failure to start the program (inspect
> $! for the reason).
> ...
>
> and so a simple
>
> $rc = system("cat ...")
>
> (which could, BTW, be written more efficiently
> without the cat but
> instead with a < to feed mailx) will hold the return
> code and you can
> then test against that.
>
> Our lovely camel book has an example where the
> divide-by-256 is done for
> you at capture time that makes this look like
>
> $rc = 0xffff & system("cat ...")
>
> and saves you a step.
>
>
> %
> %
> % Thank you!
>
> HTH & HAND
>
>
> :-D
> --
> David T-G * It's easier to
> fight for one's principles
> (play) [EMAIL PROTECTED] * than to live up to
> them. -- fortune cookie
> (work) [EMAIL PROTECTED]
> http://www.justpickone.org/davidtg/ Shpx gur
> Pbzzhavpngvbaf Qrprapl Npg!
>
>
> ATTACHMENT part 2 application/pgp-signature
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]