Re: [Boston.pm] Simultaneous redirect to STDOUT File?

2005-05-10 Thread Ben Tilly
On 5/9/05, Uri Guttman [EMAIL PROTECTED] wrote: BT == Ben Tilly [EMAIL PROTECTED] writes: BT 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

Re: [Boston.pm] Simultaneous redirect to STDOUT File?

2005-05-10 Thread Uri Guttman
BT == Ben Tilly [EMAIL PROTECTED] writes: BT Secondly even in Perl I'd expect print to be faster than using .= BT repeatedly instead of print. Let's try it: BT $ time perl -e 'print hello world\n for 1..1_000_000' /dev/null BT real0m0.379s BT user0m0.380s BT sys

Re: [Boston.pm] Simultaneous redirect to STDOUT File?

2005-05-10 Thread Ben Tilly
On 5/10/05, Uri Guttman [EMAIL PROTECTED] wrote: BT == Ben Tilly [EMAIL PROTECTED] writes: [...] BT Maintainability is more important than optimization. I often use BT this strategy for maintainance reasons. Going full-cycle, one way BT to accomplish all of this without changing code

Re: [Boston.pm] Simultaneous redirect to STDOUT File?

2005-05-10 Thread Uri Guttman
BT == Ben Tilly [EMAIL PROTECTED] writes: BT On 5/10/05, Uri Guttman [EMAIL PROTECTED] wrote: BT == Ben Tilly [EMAIL PROTECTED] writes: BT [...] BT Maintainability is more important than optimization. I often use BT this strategy for maintainance reasons. Going full-cycle, one way

[Boston.pm] Simultaneous redirect to STDOUT File?

2005-05-09 Thread Palit, Nilanjan
I want to redirect print output to both stdout a file at the same time: I can think of writing a sub that executes 2 print statements (one each to stdout the filehandle), but I was hoping someone has a more elegant solution. Thanks, -Nilanjan ___

Re: [Boston.pm] Simultaneous redirect to STDOUT File?

2005-05-09 Thread Duane Bronson
If it's Unix-only, you can open (tee output.log |) and write to that. And search.cpan.org tells me there's IO::Tee Or you could use something like log4perl which I think allows you to configure multiple appenders of which one can be stdout and another can be a log file. That might be overkill,

Re: [Boston.pm] Simultaneous redirect to STDOUT File?

2005-05-09 Thread Gyepi SAM
On Mon, May 09, 2005 at 07:48:09AM -0700, Palit, Nilanjan wrote: I want to redirect print output to both stdout a file at the same time: I can think of writing a sub that executes 2 print statements (one each to stdout the filehandle), but I was hoping someone has a more elegant solution.

Re: [Boston.pm] Simultaneous redirect to STDOUT File?

2005-05-09 Thread Palit, Nilanjan
Thanks to all who responded. IO::Tee seems to be the right solution. -Nilanjan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gyepi SAM Sent: Monday, May 09, 2005 11:35 AM To: Palit, Nilanjan Cc: Boston.PM Subject: Re: [Boston.pm] Simultaneous redirect

Re: [Boston.pm] Simultaneous redirect to STDOUT File?

2005-05-09 Thread Ben Tilly
Be aware that IO::Tee has limitations. It only works for output that goes through Perl's IO system. In particular if your program makes a system call, the child process will NOT see the tee. Cheers, Ben On 5/9/05, Duane Bronson [EMAIL PROTECTED] wrote: If it's Unix-only, you can open (tee

Re: [Boston.pm] Simultaneous redirect to STDOUT File?

2005-05-09 Thread Uri Guttman
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

Re: [Boston.pm] Simultaneous redirect to STDOUT File?

2005-05-09 Thread Ben Tilly
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

Re: [Boston.pm] Simultaneous redirect to STDOUT File?

2005-05-09 Thread Uri Guttman
BT == Ben Tilly [EMAIL PROTECTED] writes: BT 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