« AST/Grammar/ECMAScript_262_5/StringNumericLiteral/NativeNumberSemantics.pm
↑ Summary
AST/Grammar/ECMAScript_262_5/Pattern.pm »
| 1 | 18 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 18 | ▶ | use warnings FATAL => 'all'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | package MarpaX::Languages::ECMAScript::AST::Impl::Logger; | ||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | # ABSTRACT: Log::Any implementation on top of Marpa | ||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 18 | ▶ | use diagnostics; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 18 | ▶ | use MarpaX::Languages::ECMAScript::AST::Exceptions qw/:all/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 18 | ▶ | use Log::Any; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 18 | our $VERSION = '0.020'; # VERSION | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 18 | ▶ | sub BEGIN { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=3 SCAR=14.2
| |||||||||||||||||||||||||||||
| 15 | # | ||||||||||||||||||||||||||||
| 16 | ## Some Log implementation specificities | ||||||||||||||||||||||||||||
| 17 | # | ||||||||||||||||||||||||||||
| 18 | 0 | ▶ | my $log4perl = eval 'use Log::Log4perl; 1;' || 0; ## no critic | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Condition50%1/2
eval 'use Log::Log4perl; 1;' || 0
MC/DC0%0/1
eval 'use Log::Log4perl; 1;' || 0
eval 'use Log::Log4perl; 1;'
Truth table50%1/2
A
A= eval 'use Log::Log4perl; 1;'
| |||||||||||||||||||||||||||||
| 19 | 18 | ▶ | if ($log4perl) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 20 | # | ||||||||||||||||||||||||||||
| 21 | ## Here we put know hooks for logger implementations | ||||||||||||||||||||||||||||
| 22 | # | ||||||||||||||||||||||||||||
| 23 | 0 | Log::Log4perl->wrapper_register(__PACKAGE__); | |||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 17 | ▶ | sub TIEHANDLE { | ||||||||||||||||||||||||||
|
Subroutine
TIEHANDLE: called CC=4 SCAR=16.1
| |||||||||||||||||||||||||||||
| 28 | 17 | my($class, %options) = @_; | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | my $self = { | ||||||||||||||||||||||||||||
| 31 | level => exists($options{level}) ? ($options{level} || 'trace') : 'trace', | ||||||||||||||||||||||||||||
| 32 | category => exists($options{category}) ? $options{category} : undef, # undef is ok | ||||||||||||||||||||||||||||
| 33 | 17 | ▶ | }; | ||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/2
$options{"level"} or "trace"
MC/DC0%0/1
$options{"level"} or "trace"
$options{"level"}
Truth table0%0/2
A
A= $options{"level"}
| |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 17 | $self->{logger} = Log::Any->get_logger(category => $self->{category}); | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 17 | bless $self, $class; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 0 | ▶ | sub PRINT { | ||||||||||||||||||||||||||
|
Subroutine
PRINT: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 41 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 42 | 0 | ▶ | my $logger = $self->{logger} || ''; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'logger'} || ''
MC/DC0%0/1
$self->{'logger'} || ''
$self->{'logger'}
Truth table0%0/2
A
A= $self->{'logger'}
| |||||||||||||||||||||||||||||
| 43 | 0 | ▶ | my $level = $self->{level} || ''; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'level'} || ''
MC/DC0%0/1
$self->{'level'} || ''
$self->{'level'}
Truth table0%0/2
A
A= $self->{'level'}
| |||||||||||||||||||||||||||||
| 44 | 0 | ▶ | if ($logger && $level) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$logger and $level
MC/DC0%0/2
$logger and $level
$logger
$level
Truth table0%0/3
A and B
A= $loggerB= $level
| |||||||||||||||||||||||||||||
| 45 | 0 | $logger->trace(@_); | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | 0 | return 1; | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 0 | ▶ | sub PRINTF { | ||||||||||||||||||||||||||
|
Subroutine
PRINTF: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 51 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 52 | 0 | return $self->PRINT(sprintf(@_)); | |||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | ▶ | sub UNTIE { | ||||||||||||||||||||||||||
|
Subroutine
UNTIE: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 56 | 0 | my ($obj, $count) = @_; | |||||||||||||||||||||||||||
| 57 | 0 | ▶ | if ($count) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | 0 | InternalError(error => "untie attempted while $count inner references still exist"); | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 18 | 1; | |||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | __END__ | ||||||||||||||||||||||||||||