line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JE::Undefined; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.065'; |
4
|
|
|
|
|
|
|
|
5
|
99
|
|
|
99
|
|
16889
|
use strict; |
|
99
|
|
|
|
|
167
|
|
|
99
|
|
|
|
|
3085
|
|
6
|
99
|
|
|
99
|
|
403
|
use warnings; |
|
99
|
|
|
|
|
131
|
|
|
99
|
|
|
|
|
5632
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use overload fallback => 1, |
9
|
|
|
|
|
|
|
'""' => 'typeof', |
10
|
|
|
|
|
|
|
# cmp => sub { "$_[0]" cmp $_[1] }, |
11
|
|
|
|
|
|
|
bool => \&value, |
12
|
99
|
|
|
99
|
|
435
|
'0+' => sub { sin 9**9**9 }; |
|
99
|
|
|
0
|
|
133
|
|
|
99
|
|
|
|
|
774
|
|
|
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
|
106
|
|
|
106
|
0
|
187
|
sub new { bless \do{my $thing = $_[1]}, $_[0] } |
|
106
|
|
|
|
|
814
|
|
46
|
3
|
|
|
3
|
0
|
10
|
sub value { undef } |
47
|
|
|
|
|
|
|
*TO_JSON=*value; |
48
|
230
|
|
|
230
|
0
|
2098
|
sub typeof { 'undefined' } |
49
|
175
|
|
|
175
|
0
|
424
|
sub id { 'undef' } |
50
|
17
|
|
|
17
|
0
|
126
|
sub primitive { 1 } |
51
|
133
|
|
|
133
|
0
|
370
|
sub to_primitive { $_[0] } |
52
|
61
|
|
|
61
|
0
|
86
|
sub to_boolean { JE::Boolean->new(${+shift}, 0) } |
|
61
|
|
|
|
|
541
|
|
53
|
155
|
|
|
155
|
0
|
267
|
sub to_string { JE::String->_new(${+shift}, 'undefined') }; |
|
155
|
|
|
|
|
668
|
|
54
|
234
|
|
|
234
|
0
|
340
|
sub to_number { JE::Number->new(${+shift}, 'NaN') } |
|
234
|
|
|
|
|
995
|
|
55
|
1
|
|
|
1
|
0
|
2
|
sub global { ${$_[0]} } |
|
1
|
|
|
|
|
4
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
return "undef"; |
58
|
|
|
|
|
|
|
__END__ |