diff options
Diffstat (limited to 'lib/Data')
-rw-r--r-- | lib/Data/MultiValued/AttributeAccessors.pm | 24 | ||||
-rw-r--r-- | lib/Data/MultiValued/AttributeTrait.pm | 60 |
2 files changed, 40 insertions, 44 deletions
diff --git a/lib/Data/MultiValued/AttributeAccessors.pm b/lib/Data/MultiValued/AttributeAccessors.pm index 64063da..8480f98 100644 --- a/lib/Data/MultiValued/AttributeAccessors.pm +++ b/lib/Data/MultiValued/AttributeAccessors.pm @@ -11,9 +11,7 @@ use Carp 'confess'; Subclass of L<Moose::Meta::Method::Accessor>, generates non-inlined (patches welcome) accessors for multi-valued attributes. -=head1 METHDOS - -=head2 C<_instance_is_inlinable> +=method C<_instance_is_inlinable> Returns C<0> to prevent attempts to inline the accessor methods. @@ -21,15 +19,15 @@ Returns C<0> to prevent attempts to inline the accessor methods. sub _instance_is_inlinable { 0 } -=head2 C<_generate_accessor_method> +=method C<_generate_accessor_method> -=head2 C<_generate_reader_method> +=method C<_generate_reader_method> -=head2 C<_generate_writer_method> +=method C<_generate_writer_method> -=head2 C<_generate_predicate_method> +=method C<_generate_predicate_method> -=head2 C<_generate_clearer_method> +=method C<_generate_clearer_method> Delegate to C<set_multi_value>, C<get_multi_value>, C<has_multi_value>, C<clear_multi_value>, passing empty options @@ -87,15 +85,15 @@ sub _generate_clearer_method { }; } -=head2 C<_generate_multi_accessor_method> +=method C<_generate_multi_accessor_method> -=head2 C<_generate_multi_reader_method> +=method C<_generate_multi_reader_method> -=head2 C<_generate_multi_writer_method> +=method C<_generate_multi_writer_method> -=head2 C<_generate_multi_predicate_method> +=method C<_generate_multi_predicate_method> -=head2 C<_generate_multi_clearer_method> +=method C<_generate_multi_clearer_method> Delegate to C<set_multi_value>, C<get_multi_value>, C<has_multi_value>, C<clear_multi_value>, passing C<$_[1]> as options diff --git a/lib/Data/MultiValued/AttributeTrait.pm b/lib/Data/MultiValued/AttributeTrait.pm index 263b6ee..cb2cbc5 100644 --- a/lib/Data/MultiValued/AttributeTrait.pm +++ b/lib/Data/MultiValued/AttributeTrait.pm @@ -26,7 +26,7 @@ getters load the appropriate value from the multi-value object into the regular instance slot, C<after> modifiers on setters store the value from the regular instance slot into the multi-value object. -=head1 ATTRIBUTES +=attr Intro These are the attributes that this trait adds to the attribute in your class. Example: @@ -40,7 +40,7 @@ your class. Example: multi_predicate => 'has_stuff_tagged', ); -=head2 C<full_storage_slot> +=attr C<full_storage_slot> The instance slot to use to store the C<Data::MultiValued::Tags> or similar object. Defaults to C<"${name}__MULTIVALUED_STORAGE__">, where @@ -55,15 +55,15 @@ has 'full_storage_slot' => ( ); sub _build_full_storage_slot { shift->name . '__MULTIVALUED_STORAGE__' } -=head2 C<multi_accessor> +=attr C<multi_accessor> -=head2 C<multi_reader> +=attr C<multi_reader> -=head2 C<multi_writer> +=attr C<multi_writer> -=head2 C<multi_predicate> +=attr C<multi_predicate> -=head2 C<multi_clearer> +=attr C<multi_clearer> The names to use for the various additional accessors. See L<Class::MOP::Attribute> for details. These default to @@ -121,9 +121,7 @@ method of the multi-value object. requires 'opts_to_pass_get'; -=head1 METHODS - -=head2 C<slots> +=method C<slots> Adds the L</full_storage_slot> to the list of used slots. @@ -134,7 +132,7 @@ around slots => sub { return ($self->$orig(), $self->full_storage_slot); }; -=head2 C<set_full_storage> +=method C<set_full_storage> Stores a new instance of L</multivalue_storage_class> into the L</full_storage_slot> of the instance. @@ -153,7 +151,7 @@ sub set_full_storage { return $ret; } -=head2 C<get_full_storage> +=method C<get_full_storage> Retrieves the value of the L</full_storage_slot> of the instance. @@ -169,7 +167,7 @@ sub get_full_storage { ); } -=head2 C<full_storage> +=method C<full_storage> Returns an instance of L</multivalue_storage_class>, either by retrieving it from the instance, or by creating one (and setting it in @@ -184,7 +182,7 @@ sub full_storage { || $self->set_full_storage($instance); } -=head2 C<accessor_metaclass> +=method C<accessor_metaclass> Makes sure that all accessors for this attribute are created via the L<Data::MultiValued::AttributeAccessors> method meta class. @@ -193,7 +191,7 @@ L<Data::MultiValued::AttributeAccessors> method meta class. sub accessor_metaclass { 'Data::MultiValued::AttributeAccessors' } -=head2 C<install_accessors> +=method C<install_accessors> After the regular L<Moose::Meta::Attribute> method, installs the multi-value accessors. @@ -246,7 +244,7 @@ sub _filter_opts { return \%ret; } -=head2 C<load_multi_value> +=method C<load_multi_value> Retrieves a value from the multi-value object, and stores it in the regular slot in the instance. If the value is not found, clears the @@ -283,7 +281,7 @@ sub load_multi_value { } } -=head2 C<raw_clear_value> +=method C<raw_clear_value> Clears the instance slot. Does the same as L<Moose::Meta::Attribute/clear_value>, but we need this method because @@ -301,7 +299,7 @@ sub raw_clear_value { ); } -=head2 C<store_multi_value> +=method C<store_multi_value> Gets the value from the regular slot in the instance, and stores it into the multi-value object. @@ -320,7 +318,7 @@ sub store_multi_value { our $dyn_opts = {}; -=head2 C<get_value> +=method C<get_value> Before the normal method, calls L</load_multi_value>. Normally, no options will be passed to the multi-value object C<get> method. @@ -333,7 +331,7 @@ before get_value => sub { $self->load_multi_value($instance,$dyn_opts); }; -=head2 C<get_multi_value> +=method C<get_multi_value> Sets the options that L</load_multi_value> will use, then calls L</get_value>. @@ -350,7 +348,7 @@ sub get_multi_value { return $self->get_value($instance); } -=head2 C<set_initial_value> +=method C<set_initial_value> After the normal method, calls L</store_multi_value>. @@ -362,9 +360,9 @@ after set_initial_value => sub { $self->store_multi_value($instance,$dyn_opts); }; -=head2 C<set_value> +=method C<set_value> -=head2 C<set_multi_value> +=method C<set_multi_value> Just like L</get_value> and L</get_multi_value>, but calling L</store_multi_value> after the regular C<set_value> @@ -385,9 +383,9 @@ sub set_multi_value { return $self->set_value($instance,$value); } -=head2 C<has_value> +=method C<has_value> -=head2 C<has_multi_value> +=method C<has_multi_value> Just like L</get_value> and L</get_multi_value>. @@ -407,9 +405,9 @@ sub has_multi_value { return $self->has_value($instance); } -=head2 C<clear_value> +=method C<clear_value> -=head2 C<clear_multi_value> +=method C<clear_multi_value> Call the C<clear> method on the multi-value object. @@ -430,9 +428,9 @@ sub clear_multi_value { return $self->clear_value($instance); } -=head2 C<get_multi_read_method> +=method C<get_multi_read_method> -=head2 C<get_multi_write_method> +=method C<get_multi_write_method> Return the name of the reader or writer method, honoring L</multi_reader>, L</multi_writer> and L</multi_accessor>. @@ -456,7 +454,7 @@ sub get_multi_write_method { These are used through L<Data::MultiValued::UglySerializationHelperRole>. -=head2 C<_rebless_slot> +=method C<_rebless_slot> Blesses the value inside the L</full_storage_slot> of the instance into L</multivalue_storage_class>, then calls C<_rebless_storage> on @@ -474,7 +472,7 @@ sub _rebless_slot { $st->_rebless_storage; } -=head2 C<_as_hash> +=method C<_as_hash> Returns the result of calling C<_as_hash> on the value inside the L</full_storage_slot> of the instance. Returns nothing if the slot |