line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
6
|
|
|
6
|
|
781889
|
use strict; |
|
6
|
|
|
|
|
65
|
|
|
6
|
|
|
|
|
190
|
|
2
|
6
|
|
|
6
|
|
30
|
use warnings; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
288
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# ABSTRACT: Use 'unknown' values instead of undef ones |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Unknown::Values; |
7
|
|
|
|
|
|
|
$Unknown::Values::VERSION = '0.102'; |
8
|
6
|
|
|
6
|
|
126
|
use 5.01000; |
|
6
|
|
|
|
|
20
|
|
9
|
6
|
|
|
6
|
|
2308
|
use Unknown::Values::Instance; |
|
6
|
|
|
|
|
17
|
|
|
6
|
|
|
|
|
176
|
|
10
|
6
|
|
|
6
|
|
2296
|
use Unknown::Values::Instance::Fatal; |
|
6
|
|
|
|
|
13
|
|
|
6
|
|
|
|
|
153
|
|
11
|
6
|
|
|
6
|
|
2341
|
use Unknown::Values::Instance::Object; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
150
|
|
12
|
6
|
|
|
6
|
|
34
|
use Carp (); |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
98
|
|
13
|
|
|
|
|
|
|
|
14
|
6
|
|
|
6
|
|
30
|
use Scalar::Util 'blessed'; |
|
6
|
|
|
|
|
10
|
|
|
6
|
|
|
|
|
949
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub import { |
17
|
8
|
|
|
8
|
|
3362
|
my $class = shift; |
18
|
8
|
|
|
|
|
29
|
my $caller = caller; |
19
|
8
|
|
|
|
|
157
|
my $unknown_class = 'Unknown::Values::Instance'; |
20
|
8
|
100
|
|
|
|
37
|
if (@_) { |
21
|
2
|
100
|
|
|
|
7
|
if ( ':FATAL' eq $_[0] ) { |
|
|
50
|
|
|
|
|
|
22
|
1
|
|
|
|
|
2
|
$unknown_class = 'Unknown::Values::Instance::Fatal'; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
elsif ( ':OBJECT' eq $_[0] ) { |
25
|
1
|
|
|
|
|
2
|
$unknown_class = 'Unknown::Values::Instance::Object'; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
else { |
28
|
0
|
|
|
|
|
0
|
Carp::croak("I don't know how to create an Unknown::Values object of type '$_[0]'"); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
} |
31
|
8
|
|
|
|
|
38
|
my $unknown = $unknown_class->new; |
32
|
8
|
|
|
|
|
18
|
my $unknown_sub = "${caller}::unknown"; |
33
|
8
|
|
|
|
|
23
|
my $is_unknown_sub = "${caller}::is_unknown"; |
34
|
6
|
|
|
6
|
|
49
|
no strict 'refs'; |
|
6
|
|
|
|
|
28
|
|
|
6
|
|
|
|
|
1118
|
|
35
|
8
|
|
|
95
|
|
49
|
*$unknown_sub = sub {$unknown}; |
|
95
|
|
|
|
|
18960
|
|
36
|
8
|
|
|
|
|
7287
|
*$is_unknown_sub = \&is_unknown; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub is_unknown(_) { |
40
|
110
|
100
|
66
|
110
|
1
|
5620
|
defined $_[0] |
|
|
|
100
|
|
|
|
|
41
|
|
|
|
|
|
|
&& blessed( $_[0] ) |
42
|
|
|
|
|
|
|
&& ( |
43
|
|
|
|
|
|
|
# Unknown::Values::Instance::Object overrides isa() |
44
|
|
|
|
|
|
|
( 'Unknown::Values::Instance::Object' eq ref $_[0] ) || $_[0]->isa("Unknown::Values::Instance") |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |