File Coverage

blib/lib/MooseX/AttributeHelpers/MethodProvider/Bool.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 10 10 100.0
pod 4 4 100.0
total 29 29 100.0


line stmt bran cond sub pod time code
1             package MooseX::AttributeHelpers::MethodProvider::Bool;
2 22     22   88 use Moose::Role;
  22         224  
  22         110  
3              
4             our $VERSION = '0.25';
5              
6             sub set : method {
7 2     2 1 11 my ($attr, $reader, $writer) = @_;
8 2     2   21 return sub { $writer->($_[0], 1) };
  2     10   1087  
9             }
10              
11             sub unset : method {
12 2     2 1 12 my ($attr, $reader, $writer) = @_;
13 2     2   20 return sub { $writer->($_[0], 0) };
  2         635  
14             }
15              
16             sub toggle : method {
17 2     4 1 10 my ($attr, $reader, $writer) = @_;
18 2     4   18 return sub { $writer->($_[0], !$reader->($_[0])) };
  4         1154  
19             }
20              
21             sub not : method {
22 2     6 1 11 my ($attr, $reader, $writer) = @_;
23 2     8   11 return sub { !$reader->($_[0]) };
  8         3288  
24             }
25              
26             1;
27              
28             __END__
29              
30             =pod
31              
32             =encoding UTF-8
33              
34             =head1 NAME
35              
36             MooseX::AttributeHelpers::MethodProvider::Bool
37              
38             =head1 VERSION
39              
40             version 0.25
41              
42             =head1 DESCRIPTION
43              
44             This is a role which provides the method generators for
45             L<MooseX::AttributeHelpers::Bool>.
46              
47             =head1 METHODS
48              
49             =over 4
50              
51             =item B<meta>
52              
53             =back
54              
55             =head1 PROVIDED METHODS
56              
57             =over 4
58              
59             =item B<set>
60              
61             =item B<unset>
62              
63             =item B<toggle>
64              
65             =item B<not>
66              
67             =back
68              
69             =head1 SUPPORT
70              
71             Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-AttributeHelpers>
72             (or L<bug-MooseX-AttributeHelpers@rt.cpan.org|mailto:bug-MooseX-AttributeHelpers@rt.cpan.org>).
73              
74             There is also a mailing list available for users of this distribution, at
75             L<http://lists.perl.org/list/moose.html>.
76              
77             There is also an irc channel available for users of this distribution, at
78             L<C<#moose> on C<irc.perl.org>|irc://irc.perl.org/#moose>.
79              
80             =head1 AUTHOR
81              
82             Stevan Little <stevan@iinteractive.com>
83              
84             Jason May E<lt>jason.a.may@gmail.comE<gt>
85              
86             =head1 COPYRIGHT AND LICENSE
87              
88             This software is copyright (c) 2007 by Stevan Little and Infinity Interactive, Inc.
89              
90             This is free software; you can redistribute it and/or modify it under
91             the same terms as the Perl 5 programming language system itself.
92              
93             =cut