File Coverage

blib/lib/Hydrogen/Topic/Bool.pm
Criterion Covered Total %
statement 25 27 92.5
branch 4 10 40.0
condition n/a
subroutine 10 11 90.9
pod 5 5 100.0
total 44 53 83.0


line stmt bran cond sub pod time code
1             # This file was autogenerated.
2 2     2   227948 use 5.008001;
  2         13  
3 2     2   12 use strict;
  2         3  
  2         41  
4 2     2   9 use warnings;
  2         4  
  2         75  
5 2     2   12 no warnings qw( void once );
  2         4  
  2         65  
6 2     2   397 use Hydrogen ();
  2         4  
  2         112  
7              
8             package Hydrogen::Topic::Bool;
9              
10             our $AUTHORITY = 'cpan:TOBYINK';
11             our $VERSION = '0.018';
12              
13             =head1 NAME
14              
15             Hydrogen::Topic::Bool - functions from Hydrogen::Bool applied to C<$_>
16              
17             =head1 VERSION
18              
19             This documentation is for Hydrogen::Topic::Bool 0.018,
20             which is based on Sub::HandlesVia::HandlerLibrary::Bool 0.046.
21              
22             =cut
23              
24             =head1 FUNCTIONS
25              
26             Each function implicitly operates on C<< $_ >>, expecting it to be a scalar which will be treated as a boolean.
27              
28             =cut
29              
30 2         10 use Exporter::Shiny qw(
31             not
32             reset
33             set
34             toggle
35             unset
36 2     2   11 );
  2         5  
37              
38             =head2 C<< not() >>
39              
40             Operates on C<< $_ >>, which must be a scalar which will be treated as a boolean.
41              
42             Returns the opposite value of the boolean.
43              
44             =cut
45              
46             sub not {
47              
48             package Hydrogen::Bool::__SANDBOX__;
49 1 50   1 1 7471 @_ == 0
50             or Hydrogen::croak( "Wrong number of parameters for not; usage: "
51             . "Hydrogen::Topic::Bool::not()" );
52 1         7 !$_;
53             }
54              
55             =head2 C<< reset() >>
56              
57             Operates on C<< $_ >>, which must be a scalar which will be treated as a boolean.
58              
59             Sets the boolean to its default value, or false if it has no default.
60              
61             =cut
62              
63             sub reset {
64              
65             package Hydrogen::Bool::__SANDBOX__;
66 0 0   0 1 0 @_ == 0
67             or Hydrogen::croak( "Wrong number of parameters for reset; usage: "
68             . "Hydrogen::Topic::Bool::reset()" );
69 0         0 ( $_ = !!0 );
70             }
71              
72             =head2 C<< set() >>
73              
74             Operates on C<< $_ >>, which must be a scalar which will be treated as a boolean.
75              
76             Sets the value of the boolean to true.
77              
78             =cut
79              
80             sub set {
81              
82             package Hydrogen::Bool::__SANDBOX__;
83 1 50   1 1 5007 @_ == 0
84             or Hydrogen::croak( "Wrong number of parameters for set; usage: "
85             . "Hydrogen::Topic::Bool::set()" );
86 1         4 ( $_ = !!1 );
87             }
88              
89             =head2 C<< toggle() >>
90              
91             Operates on C<< $_ >>, which must be a scalar which will be treated as a boolean.
92              
93             Toggles the truth value of the boolean.
94              
95             =cut
96              
97             sub toggle {
98              
99             package Hydrogen::Bool::__SANDBOX__;
100 2 50   2 1 2877 @_ == 0
101             or Hydrogen::croak( "Wrong number of parameters for toggle; usage: "
102             . "Hydrogen::Topic::Bool::toggle()" );
103 2         6 ( $_ = !$_ );
104             }
105              
106             =head2 C<< unset() >>
107              
108             Operates on C<< $_ >>, which must be a scalar which will be treated as a boolean.
109              
110             Sets the value of the boolean to false.
111              
112             =cut
113              
114             sub unset {
115              
116             package Hydrogen::Bool::__SANDBOX__;
117 1 50   1 1 2735 @_ == 0
118             or Hydrogen::croak( "Wrong number of parameters for unset; usage: "
119             . "Hydrogen::Topic::Bool::unset()" );
120 1         3 ( $_ = !!0 );
121             }
122              
123             1;
124              
125             =head1 EXPORT
126              
127             No functions are exported by this module by default. To import them all (this is usually a bad idea), use:
128              
129             use Hydrogen::Topic::Bool -all;
130              
131             To import a particular function, use:
132              
133             use Hydrogen::Topic::Bool 'set';
134              
135             To rename functions:
136              
137             use Hydrogen::Topic::Bool 'set' => { -as => 'myfunc' };
138              
139             On Perl 5.37.2+, you can import lexically:
140              
141             use Hydrogen::Topic::Bool -lexical, 'set';
142              
143             See L for more hints on importing.
144              
145             =head1 BUGS
146              
147             Please report any bugs to
148             L.
149              
150             =head1 SEE ALSO
151              
152             L,
153             L,
154             L,
155             L.
156              
157             =head1 AUTHOR
158              
159             Toby Inkster Etobyink@cpan.orgE.
160              
161             =head1 COPYRIGHT AND LICENCE
162              
163             This software is copyright (c) 2022 by Toby Inkster.
164              
165             This is free software; you can redistribute it and/or modify it under
166             the same terms as the Perl 5 programming language system itself.
167              
168             =head1 DISCLAIMER OF WARRANTIES
169              
170             THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
171             WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
172             MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
173