http://qs321.pair.com?node_id=49670


in reply to Type Globs

You could try to define your own print function, sub print { ... } and there print to both STDOUT and files.

However, if you are on a unix system you might find the tee utility program usefull

~ 1>whatis tee tee (1) - read from standard input and write to standard output and +files
Autark.

Replies are listed 'Best First'.
Re: Type Globs
by Dominus (Parson) on Jan 04, 2001 at 07:38 UTC
    Says autark:
    You could try to define your own print function, sub print { ... }

    You can't override print.

      I don't see why it has to be called print (this was mentioned as a specific error reporting problem, I believe)...

      sub writeError { print STDERR @_; print FILE @_; # yes I know that should be Mail::Mailer, but I don't know its synta +x open MAIL, '|/usr/sbin/sendmail admin' or die; print MAIL @_; close MAIL; }
      Assuming FILE is already open and is avalible from there.

      This solution also has the advantage of allowing simple and understandable maintainability.