open() and pipes

David Cantrell david at
Wed Aug 2 10:59:12 BST 2006

On Tue, Aug 01, 2006 at 12:31:08PM -0400, Uri Guttman wrote:
> David Cantrell <david at> writes:
>> I know that you can't do this ...
>>   open(FOO, '|program|')
>> It just seems odd to me that this functionality is missing and that you
>> need to use a module for it.  Given that IPC::Open2 was bundled with the
>> very first version of perl5, it seems odd that that functionality wasn't
>> just rolled into open() at that time.
>> Am I missing something obvious?
> yes, 1 handle vs 2.
> open only takes one handle for an argument and pipe needs two handles
> (for parent and child after forking).

But FOO isn't really a handle.  It's some kind of magic data structure
which gets internally resolved to a filehandle.  I can see no reason why
it couldn't point at seperate *real* filehandles for reading and

David Cantrell | top google result for "topless karaoke murders"

    The Law of Daves: in any gathering of technical people, the
    number of Daves will be greater than the number of women.

More information about the mailing list