Help for this page

Select Code to Download


  1. or download this
    use warnings;
    use strict;
    ...
        $log->log('default log message');
        $log->log('alternate log file msg', 'not-default.log');
    }
    
  2. or download this
    $ cat default.log
    default log message
    
  3. or download this
    $ cat non-default.log
    alternate log file msg
    
  4. or download this
        sub log {
            my ($self, $msg, $log) = @_;
    ...
                # use the default fh
                $log_fh = $self->{default_log};
            }
    
  5. or download this
    open my $fh, '>>', 'alternate.log' or die $!;
    
    $log->log('msg', $fh);