line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: An Undef Object for Perl 5 |
2
|
|
|
|
|
|
|
package Data::Object::Undef; |
3
|
|
|
|
|
|
|
|
4
|
16
|
|
|
16
|
|
7550
|
use 5.010; |
|
16
|
|
|
|
|
66
|
|
|
16
|
|
|
|
|
654
|
|
5
|
|
|
|
|
|
|
|
6
|
16
|
|
|
16
|
|
82
|
use Carp 'confess'; |
|
16
|
|
|
|
|
114
|
|
|
16
|
|
|
|
|
1092
|
|
7
|
16
|
|
|
16
|
|
84
|
use Scalar::Util 'blessed'; |
|
16
|
|
|
|
|
22
|
|
|
16
|
|
|
|
|
919
|
|
8
|
16
|
|
|
16
|
|
2279
|
use Data::Object 'deduce_deep', 'detract_deep'; |
|
16
|
|
|
|
|
23
|
|
|
16
|
|
|
|
|
976
|
|
9
|
16
|
|
|
16
|
|
2801
|
use Data::Object::Class 'with'; |
|
16
|
|
|
|
|
198
|
|
|
16
|
|
|
|
|
249
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
with 'Data::Object::Role::Undef'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use overload ( |
14
|
16
|
|
|
|
|
132
|
'bool' => 'data', |
15
|
|
|
|
|
|
|
'""' => 'data', |
16
|
|
|
|
|
|
|
'~~' => 'data', |
17
|
|
|
|
|
|
|
fallback => 1, |
18
|
16
|
|
|
16
|
|
11893
|
); |
|
16
|
|
|
|
|
28
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
our $VERSION = '0.20'; # VERSION |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new { |
23
|
17
|
|
|
17
|
0
|
8393
|
my $class = shift; |
24
|
17
|
|
|
|
|
28
|
my $data = shift; |
25
|
|
|
|
|
|
|
|
26
|
17
|
|
33
|
|
|
116
|
$class = ref($class) || $class; |
27
|
17
|
50
|
33
|
|
|
104
|
unless (blessed($data) && $data->isa($class)) { |
28
|
17
|
50
|
|
|
|
50
|
confess 'Type Instantiation Error: Not an Undefined value' |
29
|
|
|
|
|
|
|
if defined $data; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
17
|
|
|
|
|
81
|
return bless \$data, $class; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub data { |
36
|
9
|
|
|
9
|
0
|
1918
|
goto &detract; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
around 'defined' => sub { |
40
|
|
|
|
|
|
|
my ($orig, $self, @args) = @_; |
41
|
|
|
|
|
|
|
my $result = $self->$orig(@args); |
42
|
|
|
|
|
|
|
return scalar deduce_deep $result; |
43
|
|
|
|
|
|
|
}; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub detract { |
46
|
10
|
|
|
10
|
0
|
41
|
return detract_deep shift; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
__END__ |