On 5/9/05, Uri Guttman <[EMAIL PROTECTED]> wrote:
> >>>>> "BT" == Ben Tilly <[EMAIL PROTECTED]> writes:
> 
>   BT> Be aware that IO::Tee has limitations.  It only works for output that
>   BT> goes through Perl's IO system.  In particular if your program makes
>   BT> a system call, the child process will NOT see the tee.
> 
> i bet you can work around that by saving STDOUT, reopening it on IO::Tee
> and having IO::Tee output to the file and the saved STDOUT. i leave
> implementing this as an exercise to the reader. but using shell to do
> this is probably the easiest as you can just use tee and all stdout
> piped to it (from the perl program or its subprocesses) will get
> teed. as larry says, the shell has to be useful for something!

You'd lose that bet.

IO::Tee is implemented through tying a filehandle inside of Perl.  The
entire mechanism only makes sense from within Perl.  A launched
subprocess (or poorly written XS code) goes through a fileno that the
operating system knows about.  Since the OS does not know about
Perl's abstractions of I/O, there is no way to get the OS to direct output
through them.

If you want to avoid the shell, the cookbook has a fork recipe for
postprocessing your own output.

Cheers,
Ben
 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to