line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Switch::Perlish::Smatch::Undef; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = '1.0.0'; |
4
|
|
|
|
|
|
|
|
5
|
11
|
|
|
11
|
|
58
|
use strict; |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
485
|
|
6
|
11
|
|
|
11
|
|
60
|
use warnings; |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
298
|
|
7
|
|
|
|
|
|
|
|
8
|
11
|
|
|
11
|
|
70
|
use Carp 'croak'; |
|
11
|
|
|
|
|
62
|
|
|
11
|
|
|
|
|
16888
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
## DESC - Return false as $m is already defined. |
11
|
1
|
|
|
1
|
|
8
|
sub _VALUE { return } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
## DESC - Return true as $m is already undefined. |
14
|
1
|
|
|
1
|
|
8
|
sub _UNDEF { return 1 } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
## DESC - Check if $$m is undef. |
17
|
|
|
|
|
|
|
sub _SCALAR { |
18
|
2
|
|
|
2
|
|
6
|
my($t, $m) = @_; |
19
|
2
|
|
|
|
|
14
|
return !defined($$m); |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
## DESC - Check for an undef in @$m. |
23
|
|
|
|
|
|
|
sub _ARRAY { |
24
|
2
|
|
|
2
|
|
4
|
my($t, $m) = @_; |
25
|
|
|
|
|
|
|
!defined and return 1 |
26
|
2
|
|
100
|
|
|
16
|
for @$m; |
27
|
1
|
|
|
|
|
9
|
return; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
## DESC - Check for an undefined value in %$m (better suggestions welcome). |
31
|
|
|
|
|
|
|
sub _HASH { |
32
|
2
|
|
|
2
|
|
4
|
my($t, $m) = @_; |
33
|
|
|
|
|
|
|
!defined and return 1 |
34
|
2
|
|
100
|
|
|
16
|
for values %$m; |
35
|
1
|
|
|
|
|
7
|
return; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
## DESC - Pass undef to &$m (to be consistent with other CODE comparators). |
39
|
|
|
|
|
|
|
sub _CODE { |
40
|
2
|
|
|
2
|
|
4
|
my($t, $m) = @_; |
41
|
2
|
|
|
|
|
7
|
return $m->($t); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
## DESC - croak("Can't compare undef with OBJECT") # Suggestions welcome. |
45
|
|
|
|
|
|
|
sub _OBJECT { |
46
|
1
|
|
|
1
|
|
214
|
croak("Can't compare undef with OBJECT"); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
## DESC - croak("Can't compare undef with Regexp") # Suggestions welcome. |
50
|
|
|
|
|
|
|
sub _Regexp { |
51
|
1
|
|
|
1
|
|
183
|
croak("Can't compare undef with Regexp"); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Switch::Perlish::Smatch->register_package( __PACKAGE__, 'UNDEF' ); |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=pod |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 NAME |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Switch::Perlish::Smatch::Undef - The C comparatory category package. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 VERSION |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1.0.0 - Initial release. |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 DESCRIPTION |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This package provides the default implementation for the C comparator |
71
|
|
|
|
|
|
|
category. For more information on the comparator implementation see. |
72
|
|
|
|
|
|
|
L. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 SEE. ALSO |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
L. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 AUTHOR |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Dan Brook C<< >> |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 COPYRIGHT |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Copyright (c) 2006, Dan Brook. All Rights Reserved. This module is free |
85
|
|
|
|
|
|
|
software. It may be used, redistributed and/or modified under the same |
86
|
|
|
|
|
|
|
terms as Perl itself. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |