line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JE::Null; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.065'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
99
|
|
|
99
|
|
34609
|
use strict; |
|
99
|
|
|
|
|
145
|
|
|
99
|
|
|
|
|
3428
|
|
7
|
99
|
|
|
99
|
|
422
|
use warnings; |
|
99
|
|
|
|
|
145
|
|
|
99
|
|
|
|
|
4911
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use overload fallback => 1, |
10
|
1
|
|
|
1
|
|
4
|
'0+' => sub { 0 }, |
11
|
|
|
|
|
|
|
'""' => 'id', |
12
|
|
|
|
|
|
|
# cmp => sub { "$_[0]" cmp $_[1] }, |
13
|
99
|
|
|
99
|
|
450
|
bool => sub { undef }; |
|
99
|
|
|
410
|
|
1853
|
|
|
99
|
|
|
|
|
938
|
|
|
410
|
|
|
|
|
1588
|
|
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
|
878
|
sub new { bless \do{my $thing = $_[1]}, $_[0] } |
|
107
|
|
|
|
|
400
|
|
52
|
4
|
|
|
4
|
0
|
2357
|
sub value { undef } |
53
|
|
|
|
|
|
|
*TO_JSON=*value; |
54
|
79
|
|
|
79
|
0
|
273
|
sub typeof { 'object' } |
55
|
174
|
|
|
174
|
0
|
1348
|
sub id { 'null' } |
56
|
1
|
|
|
1
|
0
|
4
|
sub primitive { 1 } |
57
|
118
|
|
|
118
|
0
|
288
|
sub to_primitive { $_[0] } |
58
|
21
|
|
|
21
|
0
|
27
|
sub to_boolean { JE::Boolean->new(${+shift}, '') }; |
|
21
|
|
|
|
|
115
|
|
59
|
136
|
|
|
136
|
0
|
565
|
sub to_string { JE::String->_new(${+shift}, 'null') }; |
|
136
|
|
|
|
|
475
|
|
60
|
237
|
|
|
237
|
0
|
603
|
sub to_number { JE::Number->new(${+shift}, 0) } |
|
237
|
|
|
|
|
742
|
|
61
|
2
|
|
|
2
|
0
|
838
|
sub global { ${$_[0]} } |
|
2
|
|
|
|
|
9
|
|
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
|
|
|
|
|
|
|
|