From beb592450a73ae3f284688ba0c37f078079a178d Mon Sep 17 00:00:00 2001 From: Gianni Ceccarelli Date: Thu, 1 Dec 2011 17:55:09 +0000 Subject: WIP use pod::weaver really problems: we want a Collect / Generic mix --- lib/Data/MultiValued/AttributeAccessors.pm | 24 ++++++------- lib/Data/MultiValued/AttributeTrait.pm | 58 +++++++++++++++--------------- weaver.ini | 7 ++++ 3 files changed, 46 insertions(+), 43 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, 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, C, C, C, 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, C, C, C, passing C<$_[1]> as options diff --git a/lib/Data/MultiValued/AttributeTrait.pm b/lib/Data/MultiValued/AttributeTrait.pm index 263b6ee..b514a59 100644 --- a/lib/Data/MultiValued/AttributeTrait.pm +++ b/lib/Data/MultiValued/AttributeTrait.pm @@ -40,7 +40,7 @@ your class. Example: multi_predicate => 'has_stuff_tagged', ); -=head2 C +=attr C The instance slot to use to store the C 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 +=attr C -=head2 C +=attr C -=head2 C +=attr C -=head2 C +=attr C -=head2 C +=attr C The names to use for the various additional accessors. See L for details. These default to @@ -121,9 +121,7 @@ method of the multi-value object. requires 'opts_to_pass_get'; -=head1 METHODS - -=head2 C +=method C Adds the L to the list of used slots. @@ -134,7 +132,7 @@ around slots => sub { return ($self->$orig(), $self->full_storage_slot); }; -=head2 C +=method C Stores a new instance of L into the L of the instance. @@ -153,7 +151,7 @@ sub set_full_storage { return $ret; } -=head2 C +=method C Retrieves the value of the L of the instance. @@ -169,7 +167,7 @@ sub get_full_storage { ); } -=head2 C +=method C Returns an instance of L, 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 +=method C Makes sure that all accessors for this attribute are created via the L method meta class. @@ -193,7 +191,7 @@ L method meta class. sub accessor_metaclass { 'Data::MultiValued::AttributeAccessors' } -=head2 C +=method C After the regular L method, installs the multi-value accessors. @@ -246,7 +244,7 @@ sub _filter_opts { return \%ret; } -=head2 C +=method C 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 +=method C Clears the instance slot. Does the same as L, but we need this method because @@ -301,7 +299,7 @@ sub raw_clear_value { ); } -=head2 C +=method C 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 +=method C Before the normal method, calls L. Normally, no options will be passed to the multi-value object C method. @@ -333,7 +331,7 @@ before get_value => sub { $self->load_multi_value($instance,$dyn_opts); }; -=head2 C +=method C Sets the options that L will use, then calls L. @@ -350,7 +348,7 @@ sub get_multi_value { return $self->get_value($instance); } -=head2 C +=method C After the normal method, calls L. @@ -362,9 +360,9 @@ after set_initial_value => sub { $self->store_multi_value($instance,$dyn_opts); }; -=head2 C +=method C -=head2 C +=method C Just like L and L, but calling L after the regular C @@ -385,9 +383,9 @@ sub set_multi_value { return $self->set_value($instance,$value); } -=head2 C +=method C -=head2 C +=method C Just like L and L. @@ -407,9 +405,9 @@ sub has_multi_value { return $self->has_value($instance); } -=head2 C +=method C -=head2 C +=method C Call the C method on the multi-value object. @@ -430,9 +428,9 @@ sub clear_multi_value { return $self->clear_value($instance); } -=head2 C +=method C -=head2 C +=method C Return the name of the reader or writer method, honoring L, L and L. @@ -456,7 +454,7 @@ sub get_multi_write_method { These are used through L. -=head2 C<_rebless_slot> +=method C<_rebless_slot> Blesses the value inside the L of the instance into L, 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 of the instance. Returns nothing if the slot diff --git a/weaver.ini b/weaver.ini index c4643b6..8eacf67 100644 --- a/weaver.ini +++ b/weaver.ini @@ -20,6 +20,13 @@ command = method [Collect / FUNCTIONS] command = func +[Generic / ATTRIBUTES-g] +header = ATTRIBUTES +[Generic / METHODS-g] +header = METHODS +[Generic / FUNCTIONS-g] +header = FUNCTIONS + [Leftovers] [Region / postlude] -- cgit v1.2.3