NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
why the "if" clause? (Score:1)
$log->debug("a debug message") if $log->is_debug();I'm not sure why you want the "if" clause. I'd prefer to have the debug method just do nothing unless debugging is enabled. If you're trying to avoid a method call, you'd want:
$log->debug("a debug message") if $is_debug;though personally I'd just prefer:
$log->debug("a debug message");Re:why the "if" clause? (Score:1)
$log->debug("current args: " . Dumper(\@_))
if $log->is_debug();
The idea is to use the conditional when you don't want to compute the arguments (in this case, Dumper()) unnecessarily.
Reply to This
Parent
Re: (Score:1)
$log->debug(sub {"current args: " . Dumper(\@_)});