diff --git a/lib/MooseX/AttributeShortcuts/Trait/Attribute.pm b/lib/MooseX/AttributeShortcuts/Trait/Attribute.pm index d1be91a..a913b11 100644 --- a/lib/MooseX/AttributeShortcuts/Trait/Attribute.pm +++ b/lib/MooseX/AttributeShortcuts/Trait/Attribute.pm @@ -28,10 +28,26 @@ with 'MooseX::AttributeShortcuts::Trait::Attribute::HasAnonBuilder'; =attr constraint +CodeRef, read-only. + +=method has_constraint + +Predicate for the L attribute. + =attr original_isa +=method has_original_isa + +Predicate for the L attribute. + =attr trigger_method +Contains the name of the method that will be invoked as a trigger. + +=method has_trigger_method + +Predicate for the L attribute. + =cut has constraint => ( @@ -50,10 +66,14 @@ has trigger_method => ( predicate => 'has_trigger_method', ); -# we hijack attach_to_class in order to install our anon_builder, if -# we have one. Note that we don't go the normal -# associate_method/install_accessor/etc route as this is kinda... -# different. +=after attach_to_class + +We hijack attach_to_class in order to install our anon_builder, if we have +one. Note that we don't go the normal associate_method/install_accessor/etc +route as this is kinda... different. (That is, the builder is not an +accessor of this attribute, and should not be installed as such.) + +=cut after attach_to_class => sub { my ($self, $class) = @_; @@ -67,10 +87,13 @@ after attach_to_class => sub { return; }; -# here we wrap _process_options() instead of the newer _process_is_option(), -# as that makes our life easier from a 1.x/2.x compatibility -# perspective -- and that we're potentially altering more than just -# the 'is' option at one time. +=before _process_options + +Here we wrap _process_options() instead of the newer _process_is_option(), as +that makes our life easier from a Moose 1.x/2.x compatibility perspective -- +and that we're generally altering more than just the 'is' option at one time. + +=cut before _process_options => sub { shift->_mxas_process_options(@_) }; @@ -87,6 +110,12 @@ around new => sub { return $self->$orig($name, %options); }; +=around _make_delegation_method + +Here we create and install any custom accessors that have been defined. + +=cut + # NOTE: remove_delegation() will also automagically remove any custom # accessors we create here @@ -111,16 +140,6 @@ around _make_delegation_method => sub { return $self->_process_accessors(custom => { $name => $custom_coderef }); }; -=method canonical_writer_prefix - -Returns the writer prefix; this is almost always C. - -=method canonical_builder_prefix - -Returns the builder prefix; this is almost always C<_build_>. - -=cut - sub _mxas_process_options { my ($class, $name, $options) = @_; @@ -339,6 +358,16 @@ sub _mxas_constraint { return; } +=method canonical_writer_prefix + +Returns the writer prefix; this is almost always C. + +=method canonical_builder_prefix + +Returns the builder prefix; this is almost always C<_build_>. + +=cut + role { my $p = shift @_; @@ -357,6 +386,11 @@ documentation for information on any of the new attribute options; we're mainly going to document the additional attributes, methods, and role parameters that this role provides. +All methods we include that chain off of Moose's _process_options() are +prefixed with '_mxas_' and generally are not documented in the POD; we +document any internal methods of L that we wrap or +otherwise override we document here as well. + =head1 PREFIXES We accept two parameters on the use of this module; they impact how builders