Commit | Line | Data |
063fae5e |
1 | |
2 | package MooseX::AttributeHelpers::MethodProvider::Bool; |
3 | use Moose::Role; |
4 | |
3f58c364 |
5 | our $VERSION = '0.12'; |
063fae5e |
6 | our $AUTHORITY = 'cpan:STEVAN'; |
7 | |
8 | sub set : method { |
9 | my ($attr, $reader, $writer) = @_; |
10 | return sub { $writer->($_[0], 1) }; |
11 | } |
12 | |
13 | sub unset : method { |
14 | my ($attr, $reader, $writer) = @_; |
15 | return sub { $writer->($_[0], 0) }; |
16 | } |
17 | |
18 | sub toggle : method { |
19 | my ($attr, $reader, $writer) = @_; |
20 | return sub { $writer->($_[0], !$reader->($_[0])) }; |
21 | } |
22 | |
23 | sub not : method { |
24 | my ($attr, $reader, $writer) = @_; |
25 | return sub { !$reader->($_[0]) }; |
26 | } |
27 | |
28 | 1; |
29 | |
30 | __END__ |
31 | |
32 | =pod |
33 | |
34 | =head1 NAME |
35 | |
36 | MooseX::AttributeHelpers::MethodProvider::Bool |
37 | |
38 | =head1 DESCRIPTION |
39 | |
40 | This is a role which provides the method generators for |
41 | L<MooseX::AttributeHelpers::Bool>. |
42 | |
43 | =head1 METHODS |
44 | |
45 | =over 4 |
46 | |
47 | =item B<meta> |
48 | |
49 | =back |
50 | |
51 | =head1 PROVIDED METHODS |
52 | |
53 | =over 4 |
54 | |
55 | =item B<set> |
56 | |
57 | =item B<unset> |
58 | |
59 | =item B<toggle> |
60 | |
61 | =item B<not> |
62 | |
63 | =back |
64 | |
65 | =head1 BUGS |
66 | |
67 | All complex software has bugs lurking in it, and this module is no |
68 | exception. If you find a bug please either email me, or add the bug |
69 | to cpan-RT. |
70 | |
71 | =head1 AUTHOR |
72 | |
73 | Jason May E<lt>jason.a.may@gmail.comE<gt> |
74 | |
75 | =head1 COPYRIGHT AND LICENSE |
76 | |
77 | Copyright 2007-2008 by Infinity Interactive, Inc. |
78 | |
79 | L<http://www.iinteractive.com> |
80 | |
81 | This library is free software; you can redistribute it and/or modify |
82 | it under the same terms as Perl itself. |
83 | |
84 | =cut |