Hylafax Mailing List Archives

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: sendfax knocks over perl script



On Sat, Jan 16, 1999 at 03:43:16PM +0200, Eric Smith wrote:
> Hiya
> 
> Whenever my perl scrip comes to this exec statement, it falls over and
> exits (but does _successfully_ send the fax according to the contents of
> the variables) -->
> 
>   exec "sendfax $server -R -n -d $faxno ./temp/$faxno.tmp >/dev/null";
> 
The problem isnt that the command is failing, its that the exec command 
replaces the current running process, which means that code following an
exec will never get run.  This is from the perl documentation:


=item exec PROGRAM LIST

The C<exec()> function executes a system command I<AND NEVER RETURNS> -
use C<system()> instead of C<exec()> if you want it to return. It fails and
returns FALSE only if the command does not exist I<and> it is executed
directly instead of via your system's command shell (see below).

Since it's a common mistake to use C<exec()> instead of C<system()>, Perl
warns you if there is a following statement which isn't C<die()>, C<warn()>,
or C<exit()> (if C<-w> is set  -  but you always do that).   If you
I<really> want to follow an C<exec()> with some other statement, you
can use one of these styles to avoid the warning:

-- 
        Jason Kohles -- jason@mediabang.com
        http://www.mediabang.com/

    We don't understand the software, and sometimes we don't understand the
               hardware, but we can *see* the blinking lights!



Home
Report any problems to webmaster@hylafax.org

HylaFAX is a trademark of Silicon Graphics Corporation.
Internet connectivity for hylafax.org is provided by:
VirtuALL Private Host Services