line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JE::Null; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.066'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
100
|
|
|
100
|
|
37552
|
use strict; |
|
100
|
|
|
|
|
173
|
|
|
100
|
|
|
|
|
3988
|
|
7
|
100
|
|
|
100
|
|
496
|
use warnings; |
|
100
|
|
|
|
|
165
|
|
|
100
|
|
|
|
|
5817
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use overload fallback => 1, |
10
|
1
|
|
|
1
|
|
7
|
'0+' => sub { 0 }, |
11
|
|
|
|
|
|
|
'""' => 'id', |
12
|
|
|
|
|
|
|
# cmp => sub { "$_[0]" cmp $_[1] }, |
13
|
100
|
|
|
100
|
|
753
|
bool => sub { undef }; |
|
100
|
|
|
410
|
|
1996
|
|
|
100
|
|
|
|
|
1217
|
|
|
410
|
|
|
|
|
1809
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
require JE::String; |
16
|
|
|
|
|
|
|
require JE::Boolean; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# A JE::Null object is just a reference to a global object, which itself |
20
|
|
|
|
|
|
|
# is a reference to a reference to a hash, i.e.: |
21
|
|
|
|
|
|
|
# bless \(bless \\%thing, JE), JE::Null |
22
|
|
|
|
|
|
|
# |
23
|
|
|
|
|
|
|
# so $$$$self{keys} is a list of enumerable global property names. |
24
|
|
|
|
|
|
|
# Hmm... What does ££££self{keys} mean? |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 NAME |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
JE::Null - JavaScript null value |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=head1 SYNOPSIS |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
use JE; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
$j = new JE; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$js_null = $j->null; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
$js_null->value; # undef |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 DESCRIPTION |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
This class implements the JavaScript "null" type. There really |
44
|
|
|
|
|
|
|
isn't much to it. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Null stringifies to 'null', numifies to 0, and is false as a boolean. |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=cut |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
#use Carp; |
51
|
108
|
|
|
108
|
0
|
694
|
sub new { bless \do{my $thing = $_[1]}, $_[0] } |
|
108
|
|
|
|
|
437
|
|
52
|
4
|
|
|
4
|
0
|
2131
|
sub value { undef } |
53
|
|
|
|
|
|
|
*TO_JSON=*value; |
54
|
79
|
|
|
79
|
0
|
283
|
sub typeof { 'object' } |
55
|
175
|
|
|
175
|
0
|
1467
|
sub id { 'null' } |
56
|
1
|
|
|
1
|
0
|
5
|
sub primitive { 1 } |
57
|
118
|
|
|
118
|
0
|
330
|
sub to_primitive { $_[0] } |
58
|
21
|
|
|
21
|
0
|
33
|
sub to_boolean { JE::Boolean->new(${+shift}, '') }; |
|
21
|
|
|
|
|
138
|
|
59
|
137
|
|
|
137
|
0
|
541
|
sub to_string { JE::String->_new(${+shift}, 'null') }; |
|
137
|
|
|
|
|
592
|
|
60
|
237
|
|
|
237
|
0
|
620
|
sub to_number { JE::Number->new(${+shift}, 0) } |
|
237
|
|
|
|
|
836
|
|
61
|
3
|
|
|
3
|
0
|
695
|
sub global { ${$_[0]} } |
|
3
|
|
|
|
|
40
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
"Do you really expect a module called 'null' to return a true value?!"; |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 SEE ALSO |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=over 4 |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item JE |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item JE::Types |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item JE::Undefined |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=back |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
|