line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JE::Null; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.064'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
99
|
|
|
99
|
|
32721
|
use strict; |
|
99
|
|
|
|
|
147
|
|
|
99
|
|
|
|
|
3389
|
|
7
|
99
|
|
|
99
|
|
400
|
use warnings; |
|
99
|
|
|
|
|
128
|
|
|
99
|
|
|
|
|
4741
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use overload fallback => 1, |
10
|
1
|
|
|
1
|
|
5
|
'0+' => sub { 0 }, |
11
|
|
|
|
|
|
|
'""' => 'id', |
12
|
|
|
|
|
|
|
# cmp => sub { "$_[0]" cmp $_[1] }, |
13
|
99
|
|
|
99
|
|
477
|
bool => sub { undef }; |
|
99
|
|
|
410
|
|
1855
|
|
|
99
|
|
|
|
|
949
|
|
|
410
|
|
|
|
|
1582
|
|
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
|
107
|
|
|
107
|
0
|
555
|
sub new { bless \do{my $thing = $_[1]}, $_[0] } |
|
107
|
|
|
|
|
396
|
|
52
|
4
|
|
|
4
|
0
|
1656
|
sub value { undef } |
53
|
|
|
|
|
|
|
*TO_JSON=*value; |
54
|
79
|
|
|
79
|
0
|
290
|
sub typeof { 'object' } |
55
|
174
|
|
|
174
|
0
|
1400
|
sub id { 'null' } |
56
|
1
|
|
|
1
|
0
|
3
|
sub primitive { 1 } |
57
|
118
|
|
|
118
|
0
|
310
|
sub to_primitive { $_[0] } |
58
|
21
|
|
|
21
|
0
|
22
|
sub to_boolean { JE::Boolean->new(${+shift}, '') }; |
|
21
|
|
|
|
|
107
|
|
59
|
136
|
|
|
136
|
0
|
460
|
sub to_string { JE::String->_new(${+shift}, 'null') }; |
|
136
|
|
|
|
|
472
|
|
60
|
237
|
|
|
237
|
0
|
559
|
sub to_number { JE::Number->new(${+shift}, 0) } |
|
237
|
|
|
|
|
703
|
|
61
|
2
|
|
|
2
|
0
|
569
|
sub global { ${$_[0]} } |
|
2
|
|
|
|
|
10
|
|
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
|
|
|
|
|
|
|
|