line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Perl::Role::Bool; |
2
|
|
|
|
|
|
|
$Data::Perl::Role::Bool::VERSION = '0.002011'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Wrapping class for boolean values. |
4
|
|
|
|
|
|
|
|
5
|
9
|
|
|
9
|
|
3965
|
use strictures 1; |
|
9
|
|
|
|
|
54
|
|
|
9
|
|
|
|
|
345
|
|
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
823
|
use Role::Tiny; |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
41
|
|
8
|
|
|
|
|
|
|
|
9
|
4
|
100
|
|
4
|
1
|
15
|
sub new { my $bool = $_[1] ? 1 : 0; bless(\$bool, $_[0]) } |
|
4
|
|
|
|
|
17
|
|
10
|
|
|
|
|
|
|
|
11
|
2
|
|
|
2
|
1
|
1141
|
sub set { ${$_[0]} = 1 } |
|
2
|
|
|
|
|
6
|
|
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
1
|
6
|
sub unset { ${$_[0]} = 0 } |
|
1
|
|
|
|
|
3
|
|
14
|
|
|
|
|
|
|
|
15
|
3
|
100
|
|
3
|
1
|
1070
|
sub toggle { ${$_[0]} = ${$_[0]} ? 0 : 1; } |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
12
|
|
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
2
|
1
|
500
|
sub not { !${$_[0]} } |
|
2
|
|
|
|
|
12
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
1; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=pod |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=encoding UTF-8 |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 NAME |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
Data::Perl::Role::Bool - Wrapping class for boolean values. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head1 VERSION |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
version 0.002011 |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 SYNOPSIS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
use Data::Perl qw/bool/; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $bool = bool(0); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
$bool->toggle; # 1 |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
$bool->unset; # 0 |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 DESCRIPTION |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
This class provides a wrapper and methods for interacting with boolean values. |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 PROVIDED METHODS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
None of these methods accept arguments. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=over 4 |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=item B |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Constructs a new Data::Perl::Collection::Bool object initialized with the passed |
56
|
|
|
|
|
|
|
in value, and returns it. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=item B |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Sets the value to C<1> and returns C<1>. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item B |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Set the value to C<0> and returns C<0>. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item B |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Toggles the value. If it's true, set to false, and vice versa. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Returns the new value. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item B |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Equivalent of 'not C<$value>'. |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=back |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 SEE ALSO |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=over 4 |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item * L |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=item * L |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=back |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 AUTHOR |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Matthew Phillips |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
This software is copyright (c) 2020 by Matthew Phillips . |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
97
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=cut |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__END__ |