return value from open 
Author Message
 return value from open

(Sorry for the multiple copies of my last followup; news server went
bonkers.)

I'm wondering what I'm missing about the return value from open when it
involves a fork. It seems it is always the child pid, even when the
program doesn't exist.

    $foo = open (BLETCH, "|nonexist");
    die "open failed" unless defined ($foo);
    print "Open ret is $foo.";

doesn't die with `open failed'. The result is actually:

    Can't exec "nonexist": No such file or directory at ./foo.pl line 2.
    Open ret is 7029.

Clearly the pid of the child, as documented, even though there is no
child process (any more).

Actually, I don't care specifically about the return value of the open.
What I want is to know whether the filehandle is really open or not.

Even if I set up the pipe and the child process myself, I can't see how
to tell if the filehandle is open.

The real application is that I have an incoming stream and want to send
it off to gzip, but I want to notice if gzip doesn't exist.

I suspect this is a Dumb Question, but any help would be appreciated.




Sat, 02 Nov 1996 02:25:19 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Return-value of open of nonexisting pipe

2. Return value after OPEN()

3. the returned value for open.

4. repost : Read return value from a sql script using piped open

5. read return value from a sql script using piped open

6. Sub opens window and returns value

7. PERLFUNC: values - return a list of the values in a hash

8. PERLFUNC: values - return a list of the values in a hash

9. system() return value affected by stderr redirect?

10. Return values from $ftp->put

11. Perl5 bug (in return value from subroutine?)

12. return value $?

 

 
Powered by phpBB® Forum Software