diff options
Diffstat (limited to 'lib/Data')
-rw-r--r-- | lib/Data/MultiValued/AttributeAccessors.pm | 24 | ||||
-rw-r--r-- | lib/Data/MultiValued/AttributeTrait.pm | 62 | ||||
-rw-r--r-- | lib/Data/MultiValued/RangeContainer.pm | 10 | ||||
-rw-r--r-- | lib/Data/MultiValued/Ranges.pm | 8 | ||||
-rw-r--r-- | lib/Data/MultiValued/TagContainer.pm | 12 | ||||
-rw-r--r-- | lib/Data/MultiValued/TagContainerForRanges.pm | 4 | ||||
-rw-r--r-- | lib/Data/MultiValued/Tags.pm | 8 | ||||
-rw-r--r-- | lib/Data/MultiValued/TagsAndRanges.pm | 8 | ||||
-rw-r--r-- | lib/Data/MultiValued/UglySerializationHelperRole.pm | 6 |
9 files changed, 62 insertions, 80 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..78ae31e 100644 --- a/lib/Data/MultiValued/AttributeTrait.pm +++ b/lib/Data/MultiValued/AttributeTrait.pm @@ -18,7 +18,7 @@ This role (together with L<Data::MultiValued::AttributeAccessors>) defines all the basic plumbing to glue C<Data::MultiValued::Tags> etc into Moose attributes. -=head1 Implementation details +=head2 Implementation details The multi-value object is stored in the instance slot named by the L</full_storage_slot> attribute attribute. C<before> modifiers on @@ -26,10 +26,10 @@ 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 +=head2 Attributes -These are the attributes that this trait adds to the attribute in -your class. Example: +This trait adds some attributes to the attribute declarations in your +class. Example: has stuff => ( is => 'rw', @@ -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>. diff --git a/lib/Data/MultiValued/RangeContainer.pm b/lib/Data/MultiValued/RangeContainer.pm index a444150..8dd9933 100644 --- a/lib/Data/MultiValued/RangeContainer.pm +++ b/lib/Data/MultiValued/RangeContainer.pm @@ -22,8 +22,6 @@ infinity if used as C<to>). The internal representation of a range is a hash with three keys, C<from> C<to> C<value>. -=head1 METHODS - =cut has _storage => ( @@ -39,7 +37,7 @@ has _storage => ( default => sub { [ ] }, ); -=head2 C<get> +=method C<get> my $value = $obj->get({ at => $point }); @@ -117,7 +115,7 @@ sub _partition_slots { return \@before,\@overlap,\@after; } -=head2 C<get_or_create> +=method C<get_or_create> $obj->get_or_create({ from => $min, to => $max }); @@ -152,7 +150,7 @@ sub get_or_create { return $range; } -=head2 C<clear> +=method C<clear> $obj->clear({ from => $min, to => $max }); @@ -271,7 +269,7 @@ sub _splice_slot { return $new; } -=head2 C<all_ranges> +=method C<all_ranges> my @ranges = $obj->all_ranges; diff --git a/lib/Data/MultiValued/Ranges.pm b/lib/Data/MultiValued/Ranges.pm index 3da1594..aed29f4 100644 --- a/lib/Data/MultiValued/Ranges.pm +++ b/lib/Data/MultiValued/Ranges.pm @@ -21,8 +21,6 @@ use Data::MultiValued::RangeContainer; say $obj->get({at => 15}); # prints 'foo' say $obj->get({at => 35}); # dies -=head1 METHODS - =cut has _storage => ( @@ -36,7 +34,7 @@ sub _build__storage { Data::MultiValued::RangeContainer->new(); } -=head2 C<set> +=method C<set> $obj->set({ from => $min, to => $max, value => $the_value }); @@ -83,7 +81,7 @@ sub set { ->{value} = $args{value}; } -=head2 C<get> +=method C<get> my $value = $obj->get({ at => $point }); @@ -110,7 +108,7 @@ sub get { ->{value}; } -=head2 C<clear> +=method C<clear> $obj->clear({ from => $min, to => $max }); diff --git a/lib/Data/MultiValued/TagContainer.pm b/lib/Data/MultiValued/TagContainer.pm index f6e5551..fe1a794 100644 --- a/lib/Data/MultiValued/TagContainer.pm +++ b/lib/Data/MultiValued/TagContainer.pm @@ -20,8 +20,6 @@ tag that's not there. Data is kept in "storage cells", as created by L</_create_new_inferior> (by default, a hashref). -=head1 METHODS - =cut has _storage => ( @@ -46,7 +44,7 @@ has _default_tag => ( clearer => '_clear_default_tag', ); -=head2 C<get> +=method C<get> my $value = $obj->get({ tag => $the_tag }); @@ -82,7 +80,7 @@ sub get { return $self->_get_tag($tag); } -=head2 C<get_or_create> +=method C<get_or_create> $obj->get_or_create({ tag => $the_tag }); @@ -123,7 +121,7 @@ sub _clear_storage { $self->_storage({}); } -=head2 C<clear> +=method C<clear> $obj->clear({ tag => $the_tag }); @@ -151,14 +149,14 @@ sub clear { return; } -=head2 C<all_tags> +=method C<all_tags> my @tags = $obj->all_tags; Returns all the tags defined in this object. Does not return the C<undef> tag. -=head2 C<_create_new_inferior> +=method C<_create_new_inferior> Returns a new "storage cell", by default an empty hashref. See L<Data::MultiValued::TagContainerForRanges> for an example of use. diff --git a/lib/Data/MultiValued/TagContainerForRanges.pm b/lib/Data/MultiValued/TagContainerForRanges.pm index 826df9d..8e3c2b9 100644 --- a/lib/Data/MultiValued/TagContainerForRanges.pm +++ b/lib/Data/MultiValued/TagContainerForRanges.pm @@ -15,8 +15,6 @@ This module is a subclass of L<Data::MultiValued::TagContainer>, which only allows instances of L<Data::MultiValued::RangeContainer> as "storage cells". -=head1 METHODS - =cut extends 'Data::MultiValued::TagContainer'; @@ -29,7 +27,7 @@ has '+_default_tag' => ( isa => class_type('Data::MultiValued::RangeContainer'), ); -=head2 C<_create_new_inferior> +=method C<_create_new_inferior> Returns a new L<Data::MultiValued::RangeContainer> instance. diff --git a/lib/Data/MultiValued/Tags.pm b/lib/Data/MultiValued/Tags.pm index 59ebbf5..640db40 100644 --- a/lib/Data/MultiValued/Tags.pm +++ b/lib/Data/MultiValued/Tags.pm @@ -20,8 +20,6 @@ use Data::MultiValued::TagContainer; say $obj->get({tag=>'tag1'}); # prints 'a string' say $obj->get({tag=>'tag2'}); # dies -=head1 METHODS - =cut has _storage => ( @@ -35,7 +33,7 @@ sub _build__storage { Data::MultiValued::TagContainer->new(); } -=head2 C<set> +=method C<set> $obj->set({ tag => $the_tag, value => $the_value }); @@ -61,7 +59,7 @@ sub set { ->{value} = $args{value}; } -=head2 C<get> +=method C<get> my $value = $obj->get({ tag => $the_tag }); @@ -87,7 +85,7 @@ sub get { ->{value}; } -=head2 C<clear> +=method C<clear> $obj->clear({ tag => $the_tag }); diff --git a/lib/Data/MultiValued/TagsAndRanges.pm b/lib/Data/MultiValued/TagsAndRanges.pm index 60333c8..085b8c1 100644 --- a/lib/Data/MultiValued/TagsAndRanges.pm +++ b/lib/Data/MultiValued/TagsAndRanges.pm @@ -23,8 +23,6 @@ use Data::MultiValued::TagContainerForRanges; say $obj->get({tag => 'tag1', at => 35}); # dies say $obj->get({tag => 'tag2', at => 15}); # dies -=head1 METHODS - =cut has _storage => ( @@ -38,7 +36,7 @@ sub _build__storage { Data::MultiValued::TagContainerForRanges->new(); } -=head2 C<set> +=method C<set> $obj->set({ tag => $the_tag, from => $min, to => $max, value => $the_value }); @@ -64,7 +62,7 @@ sub set { ->{value} = $args{value}; } -=head2 C<get> +=method C<get> my $value = $obj->get({ tag => $the_tag, at => $point }); @@ -92,7 +90,7 @@ sub get { ->{value}; } -=head2 C<clear> +=method C<clear> $obj->clear({ tag => $the_tag, from => $min, to => $max }); diff --git a/lib/Data/MultiValued/UglySerializationHelperRole.pm b/lib/Data/MultiValued/UglySerializationHelperRole.pm index 0c06ac6..19f1268 100644 --- a/lib/Data/MultiValued/UglySerializationHelperRole.pm +++ b/lib/Data/MultiValued/UglySerializationHelperRole.pm @@ -42,9 +42,7 @@ copies. Oh, and on de-serialise it will skip all type constraint checking and bypass the accessors, so it may well give you an unusable object. -=head1 METHODS - -=head2 C<new_in_place> +=method C<new_in_place> my $obj = My::Class->new_in_place($hashref); @@ -69,7 +67,7 @@ sub new_in_place { return $self; } -=head2 C<as_hash> +=method C<as_hash> my $hashref = $obj->as_hash; |