line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
BEGIN { |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
# For historical reasons, alias *Types::Bool with JSON::PP::Boolean |
5
|
5
|
|
|
5
|
|
274671
|
*Types::Bool:: = *JSON::PP::Boolean::; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package Types::Bool; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Booleans as objects for Perl |
11
|
|
|
|
|
|
|
|
12
|
5
|
|
|
5
|
|
152
|
use 5.005; |
|
5
|
|
|
|
|
14
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
BEGIN { |
15
|
5
|
|
|
5
|
|
4768
|
require overload; |
16
|
|
|
|
|
|
|
overload->import( |
17
|
0
|
|
|
0
|
|
0
|
'0+' => sub { ${ $_[0] } }, |
|
0
|
|
|
|
|
0
|
|
18
|
0
|
|
|
0
|
|
0
|
'++' => sub { $_[0] = ${ $_[0] } + 1 }, |
|
0
|
|
|
|
|
0
|
|
19
|
0
|
|
|
0
|
|
0
|
'--' => sub { $_[0] = ${ $_[0] } - 1 }, |
|
0
|
|
|
|
|
0
|
|
20
|
5
|
100
|
|
|
|
3879
|
fallback => 1, |
21
|
|
|
|
|
|
|
) unless overload::Method( Types::Bool, '0+' ); |
22
|
|
|
|
|
|
|
|
23
|
5
|
|
|
|
|
492
|
require constant; |
24
|
5
|
50
|
|
|
|
61
|
constant->import( true => do { bless \( my $dummy = 1 ), 'Types::Bool' } ) |
|
5
|
|
|
|
|
386
|
|
25
|
|
|
|
|
|
|
unless Types::Bool->can('true'); |
26
|
5
|
50
|
|
|
|
49
|
constant->import( false => do { bless \( my $dummy = 0 ), 'Types::Bool' } ) |
|
5
|
|
|
|
|
154
|
|
27
|
|
|
|
|
|
|
unless Types::Bool->can('false'); |
28
|
|
|
|
|
|
|
|
29
|
5
|
50
|
|
|
|
32
|
unless ( Types::Bool->can('is_bool') ) { |
30
|
5
|
|
|
|
|
31
|
require Scalar::Util; |
31
|
5
|
100
|
|
34
|
|
25
|
*is_bool = sub ($) { Scalar::Util::blessed( $_[0] ) and $_[0]->isa('Types::Bool') }; |
|
34
|
|
|
|
|
5041
|
|
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
5
|
50
|
|
|
|
665
|
$Types::Bool::VERSION = '2.98005' |
35
|
|
|
|
|
|
|
unless $Types::Bool::VERSION; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
10
|
100
|
|
10
|
0
|
3132
|
sub to_bool ($) { $_[0] ? true : false } |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
@Types::Bool::EXPORT_OK = qw(true false is_bool to_bool); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub import { # Load Exporter only if needed |
43
|
1
|
50
|
|
1
|
|
1509
|
return unless @_ > 1; |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
|
|
|
require Exporter; |
46
|
0
|
|
|
|
|
|
my $EXPORTER_VERSION = Exporter->VERSION; |
47
|
0
|
|
|
|
|
|
$EXPORTER_VERSION =~ tr/_//d; |
48
|
0
|
0
|
|
|
|
|
push @ISA, qw(Exporter) if $EXPORTER_VERSION < 5.57; |
49
|
|
|
|
|
|
|
|
50
|
5
|
|
|
5
|
|
35
|
no warnings 'redefine'; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
541
|
|
51
|
|
|
|
|
|
|
*import = sub { |
52
|
0
|
0
|
|
0
|
|
|
return unless @_ > 1; |
53
|
0
|
|
|
|
|
|
goto &Exporter::import; |
54
|
0
|
|
|
|
|
|
}; |
55
|
0
|
|
|
|
|
|
goto &Exporter::import; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |