blib/lib/Carp/Fix/1_25.pm

filter: Statementstmt 56.8% 25 / 44 Branchbran 50.0% 1 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 30.0% 3 / 10 Podpod n/a totaltotal 49.1% 30 / 61 CC 1 SCAR 5.3
CC
1
Cov
55%
_fix_carp_msg
2.0
shortmess
2.0
longmess
2.0
CRAP 1.7
↑ Summary
1 package Carp::Fix::1_25;
2  
3 # Smooth over the formatting change to Carp messages in Carp 1.25.
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 our $VERSION = '1.000001';
11  
12 1 require Carp;
13 1 require Exporter;
14 1 our @ISA = qw(Exporter);
15 1 our @EXPORT = qw(confess carp croak);
16 1 our @EXPORT_OK = qw(cluck verbose longmess shortmess);
17 1 our @EXPORT_FAIL = qw(verbose);
18  
19 1 *verbose = \&Carp::verbose;
20  
21 # Pass through to Carp 1.25 or higher, it works
22 1 ▶if( $Carp::VERSION && $Carp::VERSION >= 1.25 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($Carp::VERSION and $Carp::VERSION >= 1.25) { } 1 0 1
Condition33%1/3
$Carp::VERSION and $Carp::VERSION >= "1.25"
!ll&&!rl&&r
001
MC/DC0%0/2
$Carp::VERSION and $Carp::VERSION >= "1.25"
$Carp::VERSION $Carp::VERSION >= "1.25"
Truth table33%1/3
A and B
A= $Carp::VERSIONB= $Carp::VERSION >= "1.25"
ABresult
0X0
100
111
23 1 *carp = \&Carp::carp;
24 1 *croak = \&Carp::croak;
25 1 *cluck = \&Carp::cluck;
26 1 *confess = \&Carp::confess;
27  
28 1 *longmess = \&Carp::longmess;
29 1 *shortmess = \&Carp::shortmess;
30 }
31 # Bypass to our fixes.
32 else {
33 0 *carp = \&Carp::Fix::1_25::Fixed::carp;
34 0 *croak = \&Carp::Fix::1_25::Fixed::croak;
35 0 *cluck = \&Carp::Fix::1_25::Fixed::cluck;
36 0 *confess = \&Carp::Fix::1_25::Fixed::confess;
37  
38 0 *longmess = \&Carp::Fix::1_25::Fixed::longmess;
39 0 *shortmess = \&Carp::Fix::1_25::Fixed::shortmess;
40 }
41  
42  
43 package Carp::Fix::1_25::Fixed;
44  
45 # Tell Carp not to report our wrappers.
46 1 $Carp::Internal{"Carp::Fix::1_25::Fixed"}++;
47  
48 # Put in the dot
49 0 ▶sub _fix_carp_msg {
Subroutine _fix_carp_msg: not called CC=1 SCAR=6.9
50 0 ${$_[0]} =~ s{at (.*?) line (\d+)\n}{at $1 line $2.\n}g;
51 0 return;
52 }
53  
54  
55 0 ▶sub shortmess {
Subroutine shortmess: not called CC=1 SCAR=6.9
56 0 my $msg = Carp::shortmess(@_);
57  
58 0 _fix_carp_msg(\$msg);
59  
60 0 return $msg;
61 }
62  
63 0 ▶sub longmess {
Subroutine longmess: not called CC=1 SCAR=6.9
64 0 my $msg = Carp::longmess(@_);
65  
66 0 _fix_carp_msg(\$msg);
67  
68 0 return $msg;
69 }
70  
71  
72 0 ▶sub carp {
Subroutine carp: not called CC=1 SCAR=6.9
73 0 return warn shortmess(@_);
74 }
75  
76 0 ▶sub croak {
Subroutine croak: not called CC=1 SCAR=6.9
77 0 return die shortmess(@_);
78 }
79  
80 0 ▶sub cluck {
Subroutine cluck: not called CC=1 SCAR=6.9
81 0 return warn longmess(@_);
82 }
83  
84 0 ▶sub confess {
Subroutine confess: not called CC=1 SCAR=6.9
85 0 return die longmess(@_);
86 }
87  
88 1 1;
89  
90 __END__
↑ Summary