line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Fukurama::Class::Carp; |
2
|
|
|
|
|
|
|
our $VERSION = 0.01; |
3
|
15
|
|
|
15
|
|
25108
|
use strict; |
|
15
|
|
|
|
|
30
|
|
|
15
|
|
|
|
|
460
|
|
4
|
15
|
|
|
15
|
|
77
|
use warnings; |
|
15
|
|
|
|
|
27
|
|
|
15
|
|
|
|
|
387
|
|
5
|
|
|
|
|
|
|
|
6
|
15
|
|
|
15
|
|
96
|
use Carp(); |
|
15
|
|
|
|
|
25
|
|
|
15
|
|
|
|
|
796
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Fukurama::Class::Carp - Carp-Adapter to easy extend the carp-level |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 0.01 (beta) |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 SYNOPSIS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
use Fukurama::Class::Carp; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub foo { |
21
|
|
|
|
|
|
|
bar(); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
sub bar { |
24
|
|
|
|
|
|
|
baz(); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
sub baz { |
27
|
|
|
|
|
|
|
# would croak in foo() |
28
|
|
|
|
|
|
|
croak('its not my fault', 1); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 DESCRIPTION |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
This module provides a simple method to change the $Carp::CarpLevel locally. |
34
|
|
|
|
|
|
|
This is a helperclass for Fukurama::Class. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 CONFIG |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
- |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 EXPORT |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=over 4 |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item _carp( message:STRING, [ addCarpLevel:INT ] ) return:VOID |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
It's like Carp::carp(). It will warn about an error in the callers context. |
47
|
|
|
|
|
|
|
But you can increase the carp-level with a parameter |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=item _croak( message:STRING, [ addCarpLevel:INT ] ) return:VOID |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
It's like Carp::croak(). It will die an error in the callers context. |
52
|
|
|
|
|
|
|
But you can increase the carp-level with a parameter |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=back |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 METHODS |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
- |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 AUTHOR, BUGS, SUPPORT, ACKNOWLEDGEMENTS, COPYRIGHT & LICENSE |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
see perldoc of L |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
# AUTOMAGIC void |
67
|
|
|
|
|
|
|
sub import { |
68
|
74
|
|
|
74
|
|
170
|
my $class = $_[0]; |
69
|
|
|
|
|
|
|
|
70
|
15
|
|
|
15
|
|
72
|
no strict 'refs'; |
|
15
|
|
|
|
|
24
|
|
|
15
|
|
|
|
|
1928
|
|
71
|
|
|
|
|
|
|
|
72
|
74
|
|
|
|
|
443
|
my ($caller) = caller(0); |
73
|
74
|
|
|
|
|
187
|
*{$caller . '::_carp'} = \&_carp; |
|
74
|
|
|
|
|
424
|
|
74
|
74
|
|
|
|
|
129
|
*{$caller . '::_croak'} = \&_croak; |
|
74
|
|
|
|
|
351
|
|
75
|
74
|
|
|
|
|
17402
|
return; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
# DIRECT void |
78
|
|
|
|
|
|
|
sub _carp { |
79
|
3
|
|
|
3
|
|
3645
|
my $msg = $_[0]; |
80
|
3
|
|
|
|
|
7
|
my $level = $_[1]; |
81
|
|
|
|
|
|
|
|
82
|
3
|
|
100
|
|
|
20
|
$level ||= 0; |
83
|
|
|
|
|
|
|
|
84
|
15
|
|
|
15
|
|
80
|
no strict 'refs'; |
|
15
|
|
|
|
|
179
|
|
|
15
|
|
|
|
|
2197
|
|
85
|
|
|
|
|
|
|
|
86
|
3
|
|
|
|
|
28
|
my ($caller) = caller(0); |
87
|
3
|
|
|
|
|
12
|
local $Carp::CarpLevel = $Carp::CarpLevel + $level + 1; |
88
|
3
|
|
|
|
|
718
|
Carp::carp($msg); |
89
|
3
|
|
|
|
|
398
|
return; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
# DIRECT void |
92
|
|
|
|
|
|
|
sub _croak { |
93
|
36
|
|
|
36
|
|
1039
|
my $msg = $_[0]; |
94
|
36
|
|
|
|
|
70
|
my $level = $_[1]; |
95
|
|
|
|
|
|
|
|
96
|
36
|
|
100
|
|
|
152
|
$level ||= 0; |
97
|
|
|
|
|
|
|
|
98
|
36
|
|
|
|
|
81
|
local $Carp::CarpLevel = $Carp::CarpLevel + $level + 1; |
99
|
36
|
|
|
|
|
4842
|
Carp::croak($msg); |
100
|
0
|
|
|
|
|
|
return; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
1; |