line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JE::Boolean; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.064'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
101
|
|
|
101
|
|
32987
|
use strict; |
|
101
|
|
|
|
|
122
|
|
|
101
|
|
|
|
|
3108
|
|
7
|
101
|
|
|
101
|
|
375
|
use warnings; |
|
101
|
|
|
|
|
142
|
|
|
101
|
|
|
|
|
6082
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use overload fallback => 1, |
10
|
398
|
|
|
398
|
|
7319
|
'""' => sub { qw< false true >[shift->[0]] }, |
11
|
|
|
|
|
|
|
# cmp => sub { "$_[0]" cmp $_[1] }, |
12
|
12901
|
|
|
12901
|
|
193320
|
bool => sub { shift->[0] }, |
13
|
101
|
|
|
101
|
|
1011
|
'0+' => sub { shift->[0] }; |
|
101
|
|
|
3
|
|
3246
|
|
|
101
|
|
|
|
|
2044
|
|
|
3
|
|
|
|
|
16
|
|
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
|
30135
|
my($class, $global, $val) = @_; |
24
|
20233
|
|
|
|
|
80737
|
bless [!!$val, $global], $class; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub prop { |
29
|
3
|
100
|
|
3
|
0
|
1026
|
if(@_ > 2) { return $_[2] } # If there is a value, just return it |
|
1
|
|
|
|
|
2
|
|
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
8
|
my ($self, $name) = @_; |
32
|
|
|
|
|
|
|
|
33
|
2
|
|
|
|
|
40
|
$$self[1]->prototype_for('Boolean')->prop($name); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub keys { |
37
|
2
|
|
|
2
|
0
|
510
|
my $self = shift; |
38
|
2
|
|
|
|
|
7
|
$$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
|
|
|
|
|
18
|
$$self[1]->prototype_for('Boolean')->prop(shift)->apply( |
46
|
|
|
|
|
|
|
$self,$$self[1]->upgrade(@_) |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
51
|
5419
|
50
|
|
5419
|
0
|
10414
|
sub value { warn caller if !ref $_[0];shift->[0] } |
|
5419
|
|
|
|
|
14964
|
|
52
|
0
|
|
|
0
|
0
|
0
|
sub TO_JSON { \(0+shift->[0]) } |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
1
|
0
|
5
|
sub exists { !1 } |
55
|
|
|
|
|
|
|
|
56
|
85
|
|
|
85
|
0
|
288
|
sub typeof { 'boolean' } |
57
|
23
|
|
|
23
|
0
|
132
|
sub class { 'Boolean' } |
58
|
1026
|
|
|
1026
|
0
|
1559
|
sub id { 'bool:' . shift->value } |
59
|
11
|
|
|
11
|
0
|
29
|
sub primitive { 1 } |
60
|
|
|
|
|
|
|
|
61
|
165
|
|
|
165
|
0
|
452
|
sub to_primitive { $_[0] } |
62
|
4682
|
|
|
4682
|
0
|
9867
|
sub to_boolean { $_[0] } |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# $_[0][1] is the global object |
66
|
254
|
|
|
254
|
0
|
1135
|
sub to_string { JE::String->_new($_[0][1], qw< false true >[shift->[0]]) } |
67
|
353
|
|
|
353
|
0
|
1648
|
sub to_number { JE::Number->new($_[0][1], shift->[0]) } |
68
|
8
|
|
|
8
|
0
|
395
|
sub to_object { JE::Object::Boolean->new($_[0][1], shift) } |
69
|
|
|
|
|
|
|
|
70
|
1
|
|
|
1
|
0
|
432
|
sub global { $_[0][1] } |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
__END__ |