line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Debug::CodeBlock; |
2
|
2
|
|
|
2
|
|
118323
|
use 5.006; use strict; use warnings; our $VERSION = '0.02'; |
|
2
|
|
|
2
|
|
17
|
|
|
2
|
|
|
2
|
|
9
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
47
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
91
|
|
3
|
2
|
|
|
2
|
|
11
|
use base 'Import::Export'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
853
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our %EX = ( DEBUG => [qw/all/] ); |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub DEBUG (&) { |
8
|
2
|
|
|
2
|
1
|
1101
|
my $code = shift; |
9
|
2
|
|
|
|
|
6
|
my ($package) = caller; |
10
|
2
|
100
|
66
|
|
|
17
|
if (($package->can('DEBUG_ENABLED') && $package->DEBUG_ENABLED) or $ENV{DEBUG_PERL}) { |
|
|
|
66
|
|
|
|
|
11
|
1
|
|
|
|
|
7
|
$code->(); |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Debug::CodeBlock - Add DEBUG codeblocks to your code. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 VERSION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Version 0.02 |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 SYNOPSIS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Quick summary of what the module does. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Use %ENV and set DEBUG_PERL=1 |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
package House; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub rooms { |
34
|
|
|
|
|
|
|
my $rooms = model('House')->get_rooms(); |
35
|
|
|
|
|
|
|
DEBUG { |
36
|
|
|
|
|
|
|
print "The house has ${rooms} rooms."; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
return $rooms; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
... or you can define a DEBUG_ENABLED function in your package |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
package House; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
our $DEBUG = 1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub DEBUG_ENABLED { $DEBUG } |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub rooms { |
51
|
|
|
|
|
|
|
my $rooms = model('House')->get_rooms(); |
52
|
|
|
|
|
|
|
DEBUG { |
53
|
|
|
|
|
|
|
print "The house has ${rooms} rooms."; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
return $rooms; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 EXPORT |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 DEBUG |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 AUTHOR |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
LNATION, C<< >> |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 BUGS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
72
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
73
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 SUPPORT |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
perldoc Debug::CodeBlock |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
You can also look for information at: |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=over 4 |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
L |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item * CPAN Ratings |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
L |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item * Search CPAN |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
L |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=back |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
This software is Copyright (c) 2022 by LNATION. |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
This is free software, licensed under: |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=cut |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; # End of Debug::CodeBlock |