open() and pipes

David Cantrell david at cantrell.org.uk
Tue Aug 1 12:11:01 BST 2006


I know that you can't do this ...

  open(FOO, '|program|')

in perl to use an external program as a filter, and that the solution is
to use IPC::Open2.  But *why*?  From taking a quick look at the procmail
source*, it seems pretty easy to do.  Yes, there's loads of caveats
about buffering and so on, but if you need to do this, you need to do
it, and the caveats apply just as much to IPC::Open2 as they would to
doing it in the open() function.

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?

* which is nasty, I recommend never looking at it.  I need to scrub my
  eyes clean now.

-- 
David Cantrell | Enforcer, South London Linguistic Massive


More information about the london.pm mailing list