Skip to content

Commit

Permalink
Remove circular depency in Log::Log4perl::Appender
Browse files Browse the repository at this point in the history
only require Log::Log4perl::Config if it hasn't already been loaded

Refs #59
  • Loading branch information
lharey committed Apr 21, 2017
1 parent feaa37f commit 215e705
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions Makefile.PL
Expand Up @@ -46,6 +46,7 @@ WriteMakefile(
'PREREQ_PM' => { Test::More => 0.45,
File::Spec => 0.82,
File::Path => 2.06_06,
Class::Load => 0.23
}, # e.g., Module::Name => 1.1
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/Log/Log4perl.pm', # retrieve abstract from module
Expand Down
7 changes: 6 additions & 1 deletion lib/Log/Log4perl/Appender.pm
Expand Up @@ -6,9 +6,9 @@ use 5.006;
use strict;
use warnings;

use Log::Log4perl::Config;
use Log::Log4perl::Level;
use Carp;
use Class::Load qw/is_class_loaded/;

use constant _INTERNAL_DEBUG => 0;

Expand Down Expand Up @@ -96,6 +96,11 @@ sub new {

#whether to collapse arrays, etc.
$self->{warp_message} = $params{warp_message};

if (!is_class_loaded('Log::Log4perl::Config')) {
require Log::Log4perl::Config;
}

if($self->{warp_message} and
my $cref =
Log::Log4perl::Config::compile_if_perl($self->{warp_message})) {
Expand Down

0 comments on commit 215e705

Please sign in to comment.