in reply to Work Backup
I prefer
sub printlog { print LOG @_ unless $nolog; } printlog "======== done =========\n";
to
print LOG "======== done =========\n" unless $nolog;
as it makes for less clutter. It is also beneficial in that, with a little more work, $nolog doesn't have to pollute the namespace.
I like to generalise this functionality to handle debug/production screen output and/or log file output.BEGIN { my $nolog = 0; sub setlog { $nolog = shift; } sub printlog { print LOG @_ unless $nolog; } } setlog 1; printlog "======== done =========\n";
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Work Backup
by Anonymous Monk on May 17, 2001 at 02:39 UTC | |
by grinder (Bishop) on May 17, 2001 at 11:54 UTC | |
logging Re: Work Backup
by John M. Dlugosz (Monsignor) on May 16, 2001 at 21:51 UTC |