line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Attribute::Boolean::Value; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
21
|
|
4
|
1
|
|
|
1
|
|
3
|
use warnings; # FATAL => 'all'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
17
|
|
5
|
1
|
|
|
1
|
|
7
|
use 5.14.0; |
|
1
|
|
|
|
|
4
|
|
6
|
1
|
|
|
1
|
|
4
|
use utf8; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
6
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Attribute::Boolean::Value - An overridden class for a boolean value |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 USAGE |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
This is a private class for use only by Attribute::Boolean |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
19
|
use parent 'Exporter'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
7
|
|
19
|
1
|
|
|
1
|
|
32
|
use version; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
3
|
|
20
|
1
|
|
|
1
|
|
34
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
192
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = version->declare('v1.0.7'); |
23
|
|
|
|
|
|
|
our @EXPORT = qw(true false); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub true(); |
26
|
|
|
|
|
|
|
sub false(); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
use overload |
29
|
0
|
|
|
0
|
|
|
"0+" => sub { ${$_[0]} }, |
|
0
|
|
|
|
|
|
|
30
|
0
|
|
|
0
|
|
|
"bool" => sub { ${$_[0]} }, |
|
0
|
|
|
|
|
|
|
31
|
0
|
0
|
|
0
|
|
|
'""' => sub { ${$_[0]} ? 'true' : 'false'}, |
|
0
|
|
|
|
|
|
|
32
|
0
|
0
|
|
0
|
|
|
'!' => sub { ${$_[0]} ? false : true}, |
|
0
|
|
|
|
|
|
|
33
|
0
|
|
|
0
|
|
|
'-' => sub { croak 'subtraction not possible'}, |
34
|
0
|
|
|
0
|
|
|
'+' => sub { croak 'addition not possible'}, |
35
|
1
|
|
|
|
|
9
|
fallback => 1 |
36
|
1
|
|
|
1
|
|
926
|
; |
|
1
|
|
|
|
|
708
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $true = do { bless \(my $dummy = 1), __PACKAGE__ }; |
39
|
|
|
|
|
|
|
my $false = do { bless \(my $dummy = 0), __PACKAGE__ }; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
0
|
0
|
|
sub true() { $true } |
42
|
0
|
|
|
0
|
0
|
|
sub false() { $false } |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub TO_JSON($) { |
45
|
0
|
0
|
|
0
|
0
|
|
return $_[0] ? \1 : \0; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |