sub import { my $caller = scalar(caller); no strict 'refs'; my ($name_debug_flag, $name_debug_sub) = ("$caller\:\:DEBUG", "$caller\:\:debug"); *{$name_debug_flag} = 0; *{$name_debug_sub} = sub { $DEBUG or return 1; printf STDERR "%s() @_\n", (caller(1))[3] }; }
NAME
LEOCHARRE::Debug - debug sub
SYNOPSIS
use LEOCHARRE::Debug;
debug('hey there');
warnf '%s %s %s\n', 'this', 'is', 'a value';
SUBS
Exported.
debug()
warnf()
Works like
warn sprintf '', @args
CAVEATS
AUTHOR
Leo Charre leocharre at cpan dot org
LICENSE
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself, i.e., under the terms of the "Artistic License" or the "GNU General Public License".
DISCLAIMER
This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the "GNU General Public License" for more details.