in reply to Re: Re: Problems with open
in thread Problems with open
And if $program starts with a slash, you can just check -x $program.grep {-x "$_/$program"} split /:/ => $ENV {PATH};
The other problem is more general. If the program exists, the fork and the exec will work. The other program *will* get started. The only "problem" is that it will terminate sooner than you expect. Hence, your pipe will be "broken". In that case (printing to a pipe that was closed on the other hand), your program will get a SIGPIPE. You could write something like:
Note that you might reach the end of the eval before the SIGPIPE is delivered though.eval { local $SIG {PIPE} = sub {die "Pipe!"}; print FH "Whatever\n"; .... close FH or die; }; if ($@ && $@ =~ /^Pipe!/) { ... Do something ... }
Abigail
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Problems with open
by skerr1 (Sexton) on Jul 24, 2002 at 16:35 UTC |