line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Undef Object for Perl 5 |
2
|
|
|
|
|
|
|
package Data::Object::Undef; |
3
|
|
|
|
|
|
|
|
4
|
17
|
|
|
17
|
|
7932
|
use 5.010; |
|
17
|
|
|
|
|
56
|
|
5
|
|
|
|
|
|
|
|
6
|
17
|
|
|
17
|
|
86
|
use Scalar::Util 'blessed'; |
|
17
|
|
|
|
|
27
|
|
|
17
|
|
|
|
|
1166
|
|
7
|
17
|
|
|
17
|
|
3159
|
use Data::Object 'deduce_deep', 'detract_deep', 'throw'; |
|
17
|
|
|
|
|
132
|
|
|
17
|
|
|
|
|
1045
|
|
8
|
17
|
|
|
17
|
|
3388
|
use Data::Object::Class 'with'; |
|
17
|
|
|
|
|
38
|
|
|
17
|
|
|
|
|
140
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
with 'Data::Object::Role::Undef'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use overload ( |
13
|
17
|
|
|
|
|
149
|
'bool' => 'data', |
14
|
|
|
|
|
|
|
'""' => 'data', |
15
|
|
|
|
|
|
|
'~~' => 'data', |
16
|
|
|
|
|
|
|
fallback => 1, |
17
|
17
|
|
|
17
|
|
13777
|
); |
|
17
|
|
|
|
|
39
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our $VERSION = '0.42'; # VERSION |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
18
|
|
|
18
|
0
|
6488
|
my $class = shift; |
23
|
18
|
|
|
|
|
37
|
my $args = shift; |
24
|
18
|
|
|
|
|
91
|
my $role = 'Data::Object::Role::Type'; |
25
|
|
|
|
|
|
|
|
26
|
18
|
0
|
33
|
|
|
166
|
$args = $args->data if blessed($args) |
|
|
|
33
|
|
|
|
|
27
|
|
|
|
|
|
|
and $args->can('does') |
28
|
|
|
|
|
|
|
and $args->does($role); |
29
|
|
|
|
|
|
|
|
30
|
18
|
50
|
|
|
|
113
|
throw 'Type Instantiation Error: Not an Undefined value' |
31
|
|
|
|
|
|
|
if defined $args; |
32
|
|
|
|
|
|
|
|
33
|
18
|
|
|
|
|
100
|
return bless \$args, $class; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub data { |
37
|
10
|
|
|
10
|
0
|
2372
|
goto &detract; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
around 'defined' => sub { |
41
|
|
|
|
|
|
|
my ($orig, $self, @args) = @_; |
42
|
|
|
|
|
|
|
my $result = $self->$orig(@args); |
43
|
|
|
|
|
|
|
return scalar deduce_deep $result; |
44
|
|
|
|
|
|
|
}; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub detract { |
47
|
11
|
|
|
11
|
0
|
53
|
return detract_deep shift; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
1; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
__END__ |