|
From: Tom P. <to...@to...> - 2006-12-22 21:17:36
|
Perl version: 5.8.8
log4perl version: 1.02
Carp::Assert version: 0.18
I'm trying to use both the Carp::Assert and Log4Perl libraries in the
same Perl script. Here's how I'm using them:
use warnings;
use strict;
use Carp;
use Carp::Assert;
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init($DEBUG);
sub main() {
my $logger = get_logger();
$logger->info("Starting $0...");
my $foo = "This is a test";
assert($foo) if DEBUG;
}
When I try to compile this, I get the following errors:
/usr/lib/perl5/vendor_perl/5.8.8/Log/Log4perl.pm|131| Constant
subroutine main::DEBUG redefined
/usr/lib/perl5/vendor_perl/5.8.8/Log/Log4perl.pm|131| Prototype
mismatch: sub main::DEBUG () vs none
I tried to fix this by changing the following line:
assert($foo) if DEBUG;
to this:
assert($foo) if Carp::Assert::DEBUG;
...but I got the same error.
Does anyone know of a way I can fix this? I would really like to be
able to use Log4Perl *and* assertions in my script.
Thanks again!
Tom Purl
|