line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JE::Undefined; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.066'; |
4
|
|
|
|
|
|
|
|
5
|
100
|
|
|
100
|
|
17582
|
use strict; |
|
100
|
|
|
|
|
168
|
|
|
100
|
|
|
|
|
3366
|
|
6
|
100
|
|
|
100
|
|
448
|
use warnings; |
|
100
|
|
|
|
|
151
|
|
|
100
|
|
|
|
|
6118
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use overload fallback => 1, |
9
|
|
|
|
|
|
|
'""' => 'typeof', |
10
|
|
|
|
|
|
|
# cmp => sub { "$_[0]" cmp $_[1] }, |
11
|
|
|
|
|
|
|
bool => \&value, |
12
|
100
|
|
|
100
|
|
474
|
'0+' => sub { sin 9**9**9 }; |
|
100
|
|
|
0
|
|
162
|
|
|
100
|
|
|
|
|
872
|
|
|
0
|
|
|
|
|
0
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# ~~~ How should this numify? |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
require JE::String; |
17
|
|
|
|
|
|
|
require JE::Boolean; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 NAME |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
JE::Undefined - JavaScript undefined value |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
use JE; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$j = new JE; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$js_undefined = $j->undef; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$js_undefined->value; # undef |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 DESCRIPTION |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
This class implements the JavaScript "undefined" type. There really |
37
|
|
|
|
|
|
|
isn't much to it. |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Undefined stringifies to 'undefined', and is false as a boolean. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# A JE::Undefined object is a reference to a global object. |
44
|
|
|
|
|
|
|
|
45
|
107
|
|
|
107
|
0
|
248
|
sub new { bless \do{my $thing = $_[1]}, $_[0] } |
|
107
|
|
|
|
|
935
|
|
46
|
3
|
|
|
3
|
0
|
13
|
sub value { undef } |
47
|
|
|
|
|
|
|
*TO_JSON=*value; |
48
|
230
|
|
|
230
|
0
|
2319
|
sub typeof { 'undefined' } |
49
|
176
|
|
|
176
|
0
|
459
|
sub id { 'undef' } |
50
|
17
|
|
|
17
|
0
|
146
|
sub primitive { 1 } |
51
|
133
|
|
|
133
|
0
|
411
|
sub to_primitive { $_[0] } |
52
|
61
|
|
|
61
|
0
|
85
|
sub to_boolean { JE::Boolean->new(${+shift}, 0) } |
|
61
|
|
|
|
|
602
|
|
53
|
156
|
|
|
156
|
0
|
272
|
sub to_string { JE::String->_new(${+shift}, 'undefined') }; |
|
156
|
|
|
|
|
727
|
|
54
|
234
|
|
|
234
|
0
|
329
|
sub to_number { JE::Number->new(${+shift}, 'NaN') } |
|
234
|
|
|
|
|
1102
|
|
55
|
2
|
|
|
2
|
0
|
4
|
sub global { ${$_[0]} } |
|
2
|
|
|
|
|
30
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
return "undef"; |
58
|
|
|
|
|
|
|
__END__ |