lib/ChordPro/Logger.pm

filter: Statementstmt 73.6% 28 / 38 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 72.7% 8 / 11 Podpod n/a totaltotal 70.9% 39 / 55 CC 3 SCAR 6.0
CC
3
Cov
70%
__warn
3.5
a
2.0
b
2.0
CRAP 1.8
« blib/lib/ChordPro/lib/Data/Printer/Theme/Zellner.pm ↑ Summary lib/ChordPro/Output/SVG/Images.pm »
1 #! perl
2  
3 92 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package ChordPro::Logger;
6  
7 92 ▶use feature 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 92 ▶no warnings 'experimental::signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 92 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 92 $Carp::Internal{ (__PACKAGE__) }++;
12  
13 # die => fatal
14 # warn ? => error
15 # warn ! => warning
16 # warn => informational
17  
18 4 ▶sub _warn(@msg) {
Subroutine _warn: called CC=1 SCAR=0.0
19 4 __warn( \&CORE::warn, @msg );
20 }
21 2 ▶sub _die(@msg) {
Subroutine _die: called CC=1 SCAR=0.0
22 2 __warn( \&CORE::die, @msg );
23 }
24  
25 6 ▶sub __warn( $proc, @msg ) {
Subroutine __warn: called CC=3 SCAR=12.6
26 6 my $msg = shift(@msg);
27 6 $msg =~ s/^[?!]//;
28 6 ▶ if ( $ENV{CHORDPRO_CARP_VERBOSE} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ENV{'CHORDPRO_CARP_VERBOSE'}) { } 0 6 6
29 0 $msg .= join( '', @msg );
30 0 $msg =~ s/\n+$//;
31 0 Carp::cluck( $msg );
32 }
33 else {
34 6 $msg .= join( '', @msg );
35 6 ▶ if ( $msg =~ s/\n+$// ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($msg =~ s/\n+$//) { } 6 0 6
36 6 $msg = Carp::shortmess($msg);
37 6 chomp($msg);
38 6 $msg =~ s/ at .* line \d+\.$//s;
39 }
40 else {
41 0 $msg = Carp::shortmess($msg);
42 0 chomp($msg);
43 }
44 6 $proc->($msg."\n");
45 }
46 }
47  
48 92 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
49 92 *CORE::GLOBAL::warn = \&_warn;
50 92 *CORE::GLOBAL::die = \&_die;
51 }
52  
53 92 1;
54  
55 package main;
56  
57 92 ▶unless ( caller ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (caller) 0 92 92
58 0 require Carp;
59 0 ▶ sub a($x) { b($x) }
Subroutine a: not called CC=1 SCAR=6.9
60 0 ▶ sub b($x) { c($x) }
Subroutine b: not called CC=1 SCAR=6.9
61 0 ▶ sub c($x) { Carp::cluck($x) }
Subroutine c: not called CC=1 SCAR=6.9
62 0 a("Hi");
63 }
64  
« blib/lib/ChordPro/lib/Data/Printer/Theme/Zellner.pm ↑ Summary lib/ChordPro/Output/SVG/Images.pm »