Log-Declare reviews

RSS | Module Info | Add a review of Log-Declare

Log-Declare (0.10)

I haven't used or evaluated this module in detail, but if there is one advantage to using procedural/command syntax:

info blah;

as opposed to object syntax:

$log->info(blah);

then this module clearly demonstrates it. Using Devel::Declare (or the Perl 5.14+ keyword API), the former can be easily rewritten as something like:

info && blah;

or:

if (CONST_LOG_INFO) { info blah }

and during compilation, Perl can optimize the line away and we get zero run-time penalty when logging (level) is disabled.

(Actually, it's also possible for the object syntax to get rewritten, e.g. using source filter, but it's more cumbersome).