line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
9
|
|
|
9
|
|
876
|
use 5.008; |
|
9
|
|
|
|
|
35
|
|
2
|
9
|
|
|
9
|
|
50
|
use strict; |
|
9
|
|
|
|
|
27
|
|
|
9
|
|
|
|
|
251
|
|
3
|
9
|
|
|
9
|
|
55
|
use warnings; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
592
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
7
|
|
|
|
|
|
|
our $VERSION = '0.045'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use Sub::HandlesVia::HandlerLibrary; |
10
|
9
|
|
|
9
|
|
3351
|
our @ISA = 'Sub::HandlesVia::HandlerLibrary'; |
|
9
|
|
|
|
|
30
|
|
|
9
|
|
|
|
|
444
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use Sub::HandlesVia::Handler qw( handler ); |
13
|
9
|
|
|
9
|
|
69
|
our @METHODS = qw( set unset toggle not reset ); |
|
9
|
|
|
|
|
19
|
|
|
9
|
|
|
|
|
103
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
handler |
16
|
|
|
|
|
|
|
name => 'Bool:set', |
17
|
|
|
|
|
|
|
args => 0, |
18
|
|
|
|
|
|
|
template => '« !!1 »', |
19
|
|
|
|
|
|
|
documentation => 'Sets the value of the boolean to true.', |
20
|
|
|
|
|
|
|
_examples => sub { |
21
|
|
|
|
|
|
|
my ( $class, $attr, $method ) = @_; |
22
|
|
|
|
|
|
|
return join "", |
23
|
1
|
|
|
1
|
|
68
|
" my \$object = $class\->new();\n", |
24
|
1
|
|
|
|
|
7
|
" \$object->$method\();\n", |
25
|
|
|
|
|
|
|
" say \$object->$attr; ## ==> true\n", |
26
|
|
|
|
|
|
|
"\n"; |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
35
|
|
|
35
|
1
|
289
|
handler |
31
|
|
|
|
|
|
|
name => 'Bool:unset', |
32
|
|
|
|
|
|
|
args => 0, |
33
|
|
|
|
|
|
|
template => '« !!0 »', |
34
|
|
|
|
|
|
|
documentation => 'Sets the value of the boolean to false.', |
35
|
|
|
|
|
|
|
_examples => sub { |
36
|
|
|
|
|
|
|
my ( $class, $attr, $method ) = @_; |
37
|
|
|
|
|
|
|
return join "", |
38
|
|
|
|
|
|
|
" my \$object = $class\->new();\n", |
39
|
1
|
|
|
1
|
|
64
|
" \$object->$method\();\n", |
40
|
1
|
|
|
|
|
7
|
" say \$object->$attr; ## ==> false\n", |
41
|
|
|
|
|
|
|
"\n"; |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
handler |
46
|
35
|
|
|
35
|
1
|
267
|
name => 'Bool:toggle', |
47
|
|
|
|
|
|
|
args => 0, |
48
|
|
|
|
|
|
|
template => '« !$GET »', |
49
|
|
|
|
|
|
|
documentation => 'Toggles the truth value of the boolean.', |
50
|
|
|
|
|
|
|
_examples => sub { |
51
|
|
|
|
|
|
|
my ( $class, $attr, $method ) = @_; |
52
|
|
|
|
|
|
|
return join "", |
53
|
|
|
|
|
|
|
" my \$object = $class\->new();\n", |
54
|
|
|
|
|
|
|
" \$object->$method\();\n", |
55
|
1
|
|
|
1
|
|
62
|
" say \$object->$attr; ## ==> true\n", |
56
|
1
|
|
|
|
|
8
|
" \$object->$method\();\n", |
57
|
|
|
|
|
|
|
" say \$object->$attr; ## ==> false\n", |
58
|
|
|
|
|
|
|
"\n"; |
59
|
|
|
|
|
|
|
}, |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
handler |
63
|
|
|
|
|
|
|
name => 'Bool:not', |
64
|
35
|
|
|
35
|
1
|
255
|
args => 0, |
65
|
|
|
|
|
|
|
template => '!$GET', |
66
|
|
|
|
|
|
|
documentation => 'Returns the opposite value of the boolean.', |
67
|
|
|
|
|
|
|
_examples => sub { |
68
|
|
|
|
|
|
|
my ( $class, $attr, $method ) = @_; |
69
|
|
|
|
|
|
|
return join "", |
70
|
|
|
|
|
|
|
" my \$object = $class\->new( $attr => 1 );\n", |
71
|
|
|
|
|
|
|
" say \$object->$method\(); ## ==> false\n", |
72
|
|
|
|
|
|
|
"\n"; |
73
|
1
|
|
|
1
|
|
63
|
}, |
74
|
1
|
|
|
|
|
6
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
handler |
77
|
|
|
|
|
|
|
name => 'Bool:reset', |
78
|
|
|
|
|
|
|
args => 0, |
79
|
35
|
|
|
35
|
1
|
245
|
template => '« $DEFAULT »', |
80
|
|
|
|
|
|
|
default_for_reset => sub { 0 }, |
81
|
|
|
|
|
|
|
documentation => 'Sets the boolean to its default value, or false if it has no default.', |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |