line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JE::Boolean; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.065'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
101
|
|
|
101
|
|
32561
|
use strict; |
|
101
|
|
|
|
|
137
|
|
|
101
|
|
|
|
|
3106
|
|
7
|
101
|
|
|
101
|
|
376
|
use warnings; |
|
101
|
|
|
|
|
124
|
|
|
101
|
|
|
|
|
6828
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use overload fallback => 1, |
10
|
398
|
|
|
398
|
|
7580
|
'""' => sub { qw< false true >[shift->[0]] }, |
11
|
|
|
|
|
|
|
# cmp => sub { "$_[0]" cmp $_[1] }, |
12
|
12901
|
|
|
12901
|
|
189143
|
bool => sub { shift->[0] }, |
13
|
101
|
|
|
101
|
|
1032
|
'0+' => sub { shift->[0] }; |
|
101
|
|
|
3
|
|
1853
|
|
|
101
|
|
|
|
|
1800
|
|
|
3
|
|
|
|
|
13
|
|
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
|
20233
|
|
|
20233
|
0
|
29387
|
my($class, $global, $val) = @_; |
24
|
20233
|
|
|
|
|
79999
|
bless [!!$val, $global], $class; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub prop { |
29
|
3
|
100
|
|
3
|
0
|
712
|
if(@_ > 2) { return $_[2] } # If there is a value, just return it |
|
1
|
|
|
|
|
3
|
|
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
5
|
my ($self, $name) = @_; |
32
|
|
|
|
|
|
|
|
33
|
2
|
|
|
|
|
37
|
$$self[1]->prototype_for('Boolean')->prop($name); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub keys { |
37
|
2
|
|
|
2
|
0
|
297
|
my $self = shift; |
38
|
2
|
|
|
|
|
8
|
$$self[1]->prototype_for('Boolean')->keys; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
1
|
0
|
3
|
sub delete {1} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub method { |
44
|
4
|
|
|
4
|
0
|
6
|
my $self = shift; |
45
|
4
|
|
|
|
|
15
|
$$self[1]->prototype_for('Boolean')->prop(shift)->apply( |
46
|
|
|
|
|
|
|
$self,$$self[1]->upgrade(@_) |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
5419
|
50
|
|
5419
|
0
|
10339
|
sub value { warn caller if !ref $_[0];shift->[0] } |
|
5419
|
|
|
|
|
14813
|
|
52
|
0
|
|
|
0
|
0
|
0
|
sub TO_JSON { \(0+shift->[0]) } |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
1
|
0
|
6
|
sub exists { !1 } |
55
|
|
|
|
|
|
|
|
56
|
85
|
|
|
85
|
0
|
278
|
sub typeof { 'boolean' } |
57
|
23
|
|
|
23
|
0
|
151
|
sub class { 'Boolean' } |
58
|
1026
|
|
|
1026
|
0
|
1509
|
sub id { 'bool:' . shift->value } |
59
|
11
|
|
|
11
|
0
|
31
|
sub primitive { 1 } |
60
|
|
|
|
|
|
|
|
61
|
165
|
|
|
165
|
0
|
469
|
sub to_primitive { $_[0] } |
62
|
4682
|
|
|
4682
|
0
|
10003
|
sub to_boolean { $_[0] } |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# $_[0][1] is the global object |
66
|
254
|
|
|
254
|
0
|
1038
|
sub to_string { JE::String->_new($_[0][1], qw< false true >[shift->[0]]) } |
67
|
353
|
|
|
353
|
0
|
1493
|
sub to_number { JE::Number->new($_[0][1], shift->[0]) } |
68
|
8
|
|
|
8
|
0
|
350
|
sub to_object { JE::Object::Boolean->new($_[0][1], shift) } |
69
|
|
|
|
|
|
|
|
70
|
1
|
|
|
1
|
0
|
337
|
sub global { $_[0][1] } |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
__END__ |