diff options
author | M.J.T. Guy <mjtg@cus.cam.ac.uk> | 1998-05-09 14:53:49 +1200 |
---|---|---|
committer | Tim Bunce <Tim.Bunce@ig.co.uk> | 1998-05-12 08:58:58 +1200 |
commit | bdf560ec65a5adaa0baa01bf41071bb9ba7b96f8 (patch) | |
tree | 6575dd5f2a82e1b996b46fbfa12f9239b5e4d104 | |
parent | 59136c1613b444b66a9af87f9e54a41197bfeef3 (diff) | |
download | perl-bdf560ec65a5adaa0baa01bf41071bb9ba7b96f8.tar.gz |
Improve docs for warning about code after an exec()
I wrote
> This probably ought to be in perldoc -f exec.
... and here it is.
Credited: Chaim Frenkel <chaimf@concentric.net>
p5p-msgid: E0yYUit-0003yb-00@taurus.cus.cam.ac.uk
-rw-r--r-- | pod/perlfunc.pod | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index df13b4a987..20e496c75b 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -1081,6 +1081,15 @@ use system() instead of 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 system() instead of exec(), Perl +warns you if there is a following statement which isn't die(), warn() +or exit() (if C<-w> is set - but you always do that). If you +I<really> want to follow an exec() with some other statement, you +can use one of these styles to avoid the warning: + + exec ('foo') or print STDERR "couldn't exec foo"; + { exec ('foo') }; print STDERR "couldn't exec foo"; + If there is more than one argument in LIST, or if LIST is an array with more than one value, calls execvp(3) with the arguments in LIST. If there is only one scalar argument, the argument is checked for shell |