in reply to Re^3: Copy STDOUT and STDERR to logfile and also display to screen
in thread Copy STDOUT and STDERR to logfile and also display to screen

In your code you have to duplicate two copies of every message you print in your source; if you ever need to change the output you'd have to edit each copy of each pair of prints. It's left as an exercise to imagine the fun that commences when one or more inevitably gets out of sync and you have different results in different places for the "same" output. To say nothing of 7 months down the line when marketing wants the output also sent to a third and fourth place . . .

Using the subs (or the IO::Tee module or tee externally) you have to change just one string to affect the output to every destination.

--
We're looking for people in ATL

  • Comment on Re^4: Copy STDOUT and STDERR to logfile and also display to screen

Replies are listed 'Best First'.
Re^5: Copy STDOUT and STDERR to logfile and also display to screen
by sk (Curate) on Aug 10, 2005 at 18:26 UTC
    Gotcha! Thanks, I was not thinking about maintenance/change, which i will try to next time when i post