Perl6 RFC Librarian wrote:
> With C<$DEFERR>, all error functions are set to act on it
> instead of C<$STDERR> by default. So, the Perl 6 version
> of the above is replaced by a single, simple line of code
> at the top of your main program:
> 
>    $DEFERR = $ERRORLOG unless $have_a_tty;

  open STDERR, ">> error.log" unless $have_a_tty;
 
> Presto, all error-related functions now redirect to your
> error log automatically. All through simple assignment.
> 
> Plus, if you have functions that you want to explicitly
> print to C<$STDERR> you can still do so, another benefit:
> 
>    warn "Badness!";          # goes to $DEFERR
>    print $STDERR "Badness!"  # explicitly to $STDERR
> 
> This is not possible in Perl 5.[2]

  open ERR, ">& STDERR";
  open STDERR, ">> error.log";
  warn "Message goes to error.log";
  print ERR "Message goes to stderr";

Not intuitive perhaps, but how often do you need to do this in a
script?  (Assume all error handling is automatic.)

Jon
-- 
Knowledge is that which remains when what is
learned is forgotten. - Mr. King

Reply via email to