-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use Test::Fatal; | ||
|
||
use Log::Contextual qw(set_logger); | ||
use Log::Contextual::SimpleLogger; | ||
|
||
BEGIN { | ||
package MySuperClass; | ||
use Log::Contextual qw(:log); | ||
} | ||
|
||
BEGIN { | ||
package MyChildClass; | ||
BEGIN { our @ISA = qw(MySuperClass) }; | ||
use Log::Contextual qw(:log); | ||
|
||
sub do_thing { | ||
log_error { "child class log" }; | ||
} | ||
} | ||
|
||
my $last_log; | ||
set_logger(Log::Contextual::SimpleLogger->new({ | ||
levels => [qw(error)], | ||
coderef => sub { $last_log = shift }, | ||
})); | ||
|
||
is exception { MyChildClass->do_thing; }, undef, | ||
'log imports work in child class with exports in parent'; | ||
|
||
done_testing; |