Remove nothingmuch's nasty tabs ;)
[gitmo/Moose.git] / lib / Moose / Cookbook / Snack / Keywords.pod
CommitLineData
4499a7ab 1=pod
2
3=head1 NAME
4
5Moose::Cookbook::Snack::Keywords - Restricted keywords in Moose
6
7=cut
8
9=head1 DESCRIPTION
10
11There are several keywords exported in L<Moose> that cause clashes against
12any barewords such as attribute names, sub names, and globs.
13
14
15=head2 The 'meta' keyword
16
17While most of the reserved keywords collisions can be avoided, however
18I<meta> is the only one you B<cant> override. Do not attempt to override
19I<meta>.
20
21=head2 Moose Keywords
22
23If you are using Moose its best to avoid these keywords
24
25=over 4
26
27=item extends
28
29=item with
30
31=item has
32
33=item before
34
35=item after
36
37=item around
38
39=item super
40
41=item override
42
43=item inner
44
45=item augment
46
47=item make_immutable
48
49=item confess
50
51=item blessed
52
53=back
54
55=head2 Moose::Util::TypeConstraints Keywords
56
57If you are using Moose::Util::TypeConstraints its best to avoid
58these keywords
59
60=over 4
61
62=item type
63
64=item subtype
65
66=item class_type
67
68=item role_type
69
70=item as
71
72=item where
73
74=item message
75
76=item optimize_as
77
78=item coerce
79
80=item from
81
82=item via
83
84=item enum
85
86=item find_type_constraint
87
88=item register_type_constraint
89
90=back
91
92=head2 Avoiding collisions
93
94=head3 Turning off Moose
95
96To remove the keywords Moose exports using no Moose at the bottom of your code
97
98 package Thing;
99 use Moose;
100
101 # code here
102
103 no Moose;
104
105=head3 Sub::Exporter
106
107The L<Sub::Exporter> module can rename keywords
108
109 package LOL::Cat;
110 use Moose 'has' => { -as => 'i_can_haz' };
111
112 i_can_haz 'cheeseburger' => (
113 is => 'rw',
114 trigger => sub { print "NOM NOM" }
115 );
116
117 LOL::Cat->new->cheeseburger('KTHNXBYE');;
118
119=head3 namespace::clean
120
121You can use L<namespace::clean> to clean up the namespace
122
123=head1 AUTHOR AND COPYRIGHT
124
125John Goulah C<E<lt>jgoulah@cpan.org<gt>>
126
127=head1 LICENSE
128
129This program is free software; you can redistribute it and/or modify
130it under the same terms as perl itself.
131
132=cut