Commit | Line | Data |
76251922 |
1 | package MooseX::HasDefaults; |
c80c0e3b |
2 | our $VERSION = '0.03'; |
76251922 |
3 | |
42065130 |
4 | die "Do not use MooseX::HasDefaults, use MooseX::HasDefaults::RO or MooseX::HasDefaults::RW"; |
5 | |
6 | "Screw you Perl, I want to return a true value just to spite you even though it's a load failure. Can we PLEASE get rid of the required module return value? Require modules to die instead, like I just did. SIGH!"; |
7 | |
8 | __END__ |
9 | |
10 | =head1 NAME |
11 | |
12 | MooseX::HasDefaults - default "is" to "ro" or "rw" for all attributes |
13 | |
14 | =head1 SYNOPSIS |
15 | |
16 | package Person; |
17 | use Moose; |
18 | use MooseX::HasDefaults::RO; |
19 | |
20 | has name => ( |
21 | isa => 'Str', |
22 | ); |
23 | |
24 | has age => ( |
25 | is => 'rw', |
26 | isa => 'Int', |
27 | documentation => "Changes most years", |
28 | ); |
29 | |
30 | =head1 DESCRIPTION |
31 | |
0fb18126 |
32 | The module L<MooseX::HasDefaults::RO> defaults C<is> to C<ro>. |
33 | |
34 | The module L<MooseX::HasDefaults::RW> defaults C<is> to C<rw>. |
35 | |
36 | If you pass a specific value to any C<has>'s C<is>, that overrides the default. If you do not want an accessor, pass C<< is => undef >>. |
37 | |
38 | =head1 AUTHOR |
39 | |
40 | Shawn M Moore, C<sartak@gmail.com> |
41 | |
1a6afd4e |
42 | =head1 SEE ALSO |
43 | |
44 | =over 4 |
45 | |
46 | =item L<MooseX::AttributeDefaults> |
47 | |
48 | This requires its users to be MOP savvy, and is a bit too much typing for |
49 | the common case of defaulting C<is>. |
50 | |
51 | =item L<MooseX::Attributes::Curried> |
52 | |
53 | This solves a similar need by letting users create sugar functions. But |
54 | people like C<has>. |
55 | |
56 | =back |
57 | |
0fb18126 |
58 | =head1 COPYRIGHT AND LICENSE |
59 | |
60 | Copyright 2009 Infinity Interactive |
61 | |
62 | This program is free software; you can redistribute it and/or modify it |
63 | under the same terms as Perl itself. |
42065130 |
64 | |
65 | =cut |
66 | |