line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Carp::Fix::1_25; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Smooth over the formatting change to Carp messages in Carp 1.25. |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
346077
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
39
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
21
|
use 5.008; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
701
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.000001'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
require Carp; |
13
|
|
|
|
|
|
|
require Exporter; |
14
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
15
|
|
|
|
|
|
|
our @EXPORT = qw(confess carp croak); |
16
|
|
|
|
|
|
|
our @EXPORT_OK = qw(cluck verbose longmess shortmess); |
17
|
|
|
|
|
|
|
our @EXPORT_FAIL = qw(verbose); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
*verbose = \&Carp::verbose; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Pass through to Carp 1.25 or higher, it works |
22
|
|
|
|
|
|
|
if( $Carp::VERSION && $Carp::VERSION >= 1.25 ) { |
23
|
|
|
|
|
|
|
*carp = \&Carp::carp; |
24
|
|
|
|
|
|
|
*croak = \&Carp::croak; |
25
|
|
|
|
|
|
|
*cluck = \&Carp::cluck; |
26
|
|
|
|
|
|
|
*confess = \&Carp::confess; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
*longmess = \&Carp::longmess; |
29
|
|
|
|
|
|
|
*shortmess = \&Carp::shortmess; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
# Bypass to our fixes. |
32
|
|
|
|
|
|
|
else { |
33
|
|
|
|
|
|
|
*carp = \&Carp::Fix::1_25::Fixed::carp; |
34
|
|
|
|
|
|
|
*croak = \&Carp::Fix::1_25::Fixed::croak; |
35
|
|
|
|
|
|
|
*cluck = \&Carp::Fix::1_25::Fixed::cluck; |
36
|
|
|
|
|
|
|
*confess = \&Carp::Fix::1_25::Fixed::confess; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
*longmess = \&Carp::Fix::1_25::Fixed::longmess; |
39
|
|
|
|
|
|
|
*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
|
|
|
|
|
|
|
$Carp::Internal{"Carp::Fix::1_25::Fixed"}++; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# Put in the dot |
49
|
|
|
|
|
|
|
sub _fix_carp_msg { |
50
|
0
|
|
|
0
|
|
|
${$_[0]} =~ s{at (.*?) line (\d+)\n}{at $1 line $2.\n}g; |
|
0
|
|
|
|
|
|
|
51
|
0
|
|
|
|
|
|
return; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub shortmess { |
56
|
0
|
|
|
0
|
|
|
my $msg = Carp::shortmess(@_); |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
_fix_carp_msg(\$msg); |
59
|
|
|
|
|
|
|
|
60
|
0
|
|
|
|
|
|
return $msg; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub longmess { |
64
|
0
|
|
|
0
|
|
|
my $msg = Carp::longmess(@_); |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
_fix_carp_msg(\$msg); |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return $msg; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
sub carp { |
73
|
0
|
|
|
0
|
|
|
return warn shortmess(@_); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub croak { |
77
|
0
|
|
|
0
|
|
|
return die shortmess(@_); |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub cluck { |
81
|
0
|
|
|
0
|
|
|
return warn longmess(@_); |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub confess { |
85
|
0
|
|
|
0
|
|
|
return die longmess(@_); |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
__END__ |