line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JE::Undefined; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.064'; |
4
|
|
|
|
|
|
|
|
5
|
99
|
|
|
99
|
|
15784
|
use strict; |
|
99
|
|
|
|
|
198
|
|
|
99
|
|
|
|
|
2957
|
|
6
|
99
|
|
|
99
|
|
398
|
use warnings; |
|
99
|
|
|
|
|
125
|
|
|
99
|
|
|
|
|
5716
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
use overload fallback => 1, |
9
|
|
|
|
|
|
|
'""' => 'typeof', |
10
|
|
|
|
|
|
|
# cmp => sub { "$_[0]" cmp $_[1] }, |
11
|
|
|
|
|
|
|
bool => \&value, |
12
|
99
|
|
|
99
|
|
431
|
'0+' => sub { sin 9**9**9 }; |
|
99
|
|
|
0
|
|
146
|
|
|
99
|
|
|
|
|
742
|
|
|
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
|
175
|
sub new { bless \do{my $thing = $_[1]}, $_[0] } |
|
106
|
|
|
|
|
837
|
|
46
|
3
|
|
|
3
|
0
|
11
|
sub value { undef } |
47
|
|
|
|
|
|
|
*TO_JSON=*value; |
48
|
230
|
|
|
230
|
0
|
1981
|
sub typeof { 'undefined' } |
49
|
175
|
|
|
175
|
0
|
415
|
sub id { 'undef' } |
50
|
17
|
|
|
17
|
0
|
127
|
sub primitive { 1 } |
51
|
133
|
|
|
133
|
0
|
342
|
sub to_primitive { $_[0] } |
52
|
61
|
|
|
61
|
0
|
59
|
sub to_boolean { JE::Boolean->new(${+shift}, 0) } |
|
61
|
|
|
|
|
602
|
|
53
|
155
|
|
|
155
|
0
|
234
|
sub to_string { JE::String->_new(${+shift}, 'undefined') }; |
|
155
|
|
|
|
|
664
|
|
54
|
234
|
|
|
234
|
0
|
325
|
sub to_number { JE::Number->new(${+shift}, 'NaN') } |
|
234
|
|
|
|
|
977
|
|
55
|
1
|
|
|
1
|
0
|
2
|
sub global { ${$_[0]} } |
|
1
|
|
|
|
|
4
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
return "undef"; |
58
|
|
|
|
|
|
|
__END__ |