line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JE::Boolean; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.066'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
101
|
|
|
101
|
|
35819
|
use strict; |
|
101
|
|
|
|
|
143
|
|
|
101
|
|
|
|
|
3474
|
|
7
|
101
|
|
|
101
|
|
442
|
use warnings; |
|
101
|
|
|
|
|
145
|
|
|
101
|
|
|
|
|
7202
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use overload fallback => 1, |
10
|
398
|
|
|
398
|
|
9246
|
'""' => sub { qw< false true >[shift->[0]] }, |
11
|
|
|
|
|
|
|
# cmp => sub { "$_[0]" cmp $_[1] }, |
12
|
12901
|
|
|
12901
|
|
239532
|
bool => sub { shift->[0] }, |
13
|
101
|
|
|
101
|
|
574
|
'0+' => sub { shift->[0] }; |
|
101
|
|
|
3
|
|
2539
|
|
|
101
|
|
|
|
|
3188
|
|
|
3
|
|
|
|
|
15
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# ~~~ to do: make sure it numifies properly (as 0 or 1) |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
require JE::Object::Boolean; |
18
|
|
|
|
|
|
|
require JE::Number; |
19
|
|
|
|
|
|
|
require JE::String; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub new { |
23
|
20235
|
|
|
20235
|
0
|
36050
|
my($class, $global, $val) = @_; |
24
|
20235
|
|
|
|
|
98543
|
bless [!!$val, $global], $class; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub prop { |
29
|
3
|
100
|
|
3
|
0
|
742
|
if(@_ > 2) { return $_[2] } # If there is a value, just return it |
|
1
|
|
|
|
|
3
|
|
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
5
|
my ($self, $name) = @_; |
32
|
|
|
|
|
|
|
|
33
|
2
|
|
|
|
|
36
|
$$self[1]->prototype_for('Boolean')->prop($name); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub keys { |
37
|
2
|
|
|
2
|
0
|
354
|
my $self = shift; |
38
|
2
|
|
|
|
|
9
|
$$self[1]->prototype_for('Boolean')->keys; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
1
|
0
|
4
|
sub delete {1} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub method { |
44
|
4
|
|
|
4
|
0
|
6
|
my $self = shift; |
45
|
4
|
|
|
|
|
17
|
$$self[1]->prototype_for('Boolean')->prop(shift)->apply( |
46
|
|
|
|
|
|
|
$self,$$self[1]->upgrade(@_) |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
5419
|
50
|
|
5419
|
0
|
12808
|
sub value { warn caller if !ref $_[0];shift->[0] } |
|
5419
|
|
|
|
|
17600
|
|
52
|
0
|
|
|
0
|
0
|
0
|
sub TO_JSON { \(0+shift->[0]) } |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
1
|
0
|
4
|
sub exists { !1 } |
55
|
|
|
|
|
|
|
|
56
|
85
|
|
|
85
|
0
|
330
|
sub typeof { 'boolean' } |
57
|
23
|
|
|
23
|
0
|
139
|
sub class { 'Boolean' } |
58
|
1026
|
|
|
1026
|
0
|
1552
|
sub id { 'bool:' . shift->value } |
59
|
11
|
|
|
11
|
0
|
28
|
sub primitive { 1 } |
60
|
|
|
|
|
|
|
|
61
|
165
|
|
|
165
|
0
|
527
|
sub to_primitive { $_[0] } |
62
|
4682
|
|
|
4682
|
0
|
12366
|
sub to_boolean { $_[0] } |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# $_[0][1] is the global object |
66
|
254
|
|
|
254
|
0
|
1401
|
sub to_string { JE::String->_new($_[0][1], qw< false true >[shift->[0]]) } |
67
|
353
|
|
|
353
|
0
|
1796
|
sub to_number { JE::Number->new($_[0][1], shift->[0]) } |
68
|
8
|
|
|
8
|
0
|
302
|
sub to_object { JE::Object::Boolean->new($_[0][1], shift) } |
69
|
|
|
|
|
|
|
|
70
|
1
|
|
|
1
|
0
|
323
|
sub global { $_[0][1] } |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
__END__ |