summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>2011-12-05 11:19:37 +0000
committerGianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>2011-12-05 11:19:37 +0000
commit7b3391b9d6721f6dd7eddd27638e23ab53b649bc (patch)
treedcef42a505ea8a5b25e89f69a93d20d6b2018c2f
parentBuild results of beb5924 (on master) (diff)
parentWIP use pod::weaver really (diff)
downloaddata-multivalued-7b3391b9d6721f6dd7eddd27638e23ab53b649bc.tar.gz
data-multivalued-7b3391b9d6721f6dd7eddd27638e23ab53b649bc.tar.bz2
data-multivalued-7b3391b9d6721f6dd7eddd27638e23ab53b649bc.zip
Build results of beb5924 (on master)
-rw-r--r--Changes2
-rw-r--r--lib/Data/MultiValued/AttributeAccessors.pm35
-rw-r--r--lib/Data/MultiValued/AttributeTrait.pm199
3 files changed, 52 insertions, 184 deletions
diff --git a/Changes b/Changes
index 1e88288..63fb4b5 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,6 @@
Revision history for Data::MultiValued
-0.0.1_3 2011-12-05 11:17:20 Europe/London
+0.0.1_3 2011-12-05 11:19:32 Europe/London
0.0.1_2 2011-11-30 11:01:47 Europe/London
- remove the need for perl 5.12
diff --git a/lib/Data/MultiValued/AttributeAccessors.pm b/lib/Data/MultiValued/AttributeAccessors.pm
index b5f0d65..63e9281 100644
--- a/lib/Data/MultiValued/AttributeAccessors.pm
+++ b/lib/Data/MultiValued/AttributeAccessors.pm
@@ -134,39 +134,10 @@ version 0.0.1_3
=head1 DESCRIPTION
-=head2 C<_instance_is_inlinable>
-
-Returns C<0> to prevent attempts to inline the accessor methods.
-
-=head2 C<_generate_accessor_method>
-
-=head2 C<_generate_reader_method>
-
-=head2 C<_generate_writer_method>
-
-=head2 C<_generate_predicate_method>
-
-=head2 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
-(i.e. no tags, no ranges).
-
-=head2 C<_generate_multi_accessor_method>
-
-=head2 C<_generate_multi_reader_method>
-
-=head2 C<_generate_multi_writer_method>
-
-=head2 C<_generate_multi_predicate_method>
-
-=head2 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
-and C<$_[2]> as values.
+Subclass of L<Moose::Meta::Method::Accessor>, generates non-inlined
+(patches welcome) accessors for multi-valued attributes.
-=head1 DESCRIPTION
+=head1 METHODS
=head2 C<_instance_is_inlinable>
diff --git a/lib/Data/MultiValued/AttributeTrait.pm b/lib/Data/MultiValued/AttributeTrait.pm
index d24c6d9..167fc4d 100644
--- a/lib/Data/MultiValued/AttributeTrait.pm
+++ b/lib/Data/MultiValued/AttributeTrait.pm
@@ -291,119 +291,78 @@ version 0.0.1_3
=head1 DESCRIPTION
-=head2 C<slots>
-
-Adds the L</full_storage_slot> to the list of used slots.
-
-=head2 C<set_full_storage>
-
-Stores a new instance of L</multivalue_storage_class> into the
-L</full_storage_slot> of the instance.
-
-=head2 C<get_full_storage>
-
-Retrieves the value of the L</full_storage_slot> of the instance.
-
-=head2 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
-the instance). Calls L</get_full_storage> and L</set_full_storage>.
-
-=head2 C<accessor_metaclass>
-
-Makes sure that all accessors for this attribute are created via the
-L<Data::MultiValued::AttributeAccessors> method meta class.
-
-=head2 C<install_accessors>
-
-After the regular L<Moose::Meta::Attribute> method, installs the
-multi-value accessors.
-
-Each installed normal accessor gets a multi-value version
-
-You can add or rename the multi-value version by using the attributes
-described above
-
-If you are passing explicit subrefs for your accessors, things won't work.
-
-=head2 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
-slot.
-
-This traps the
-L<Data::MultiValued::Exceptions::NotFound|Data::MultiValued::Exceptions/Data::MultiValued::Exceptions::NotFound>
-exception that may be thrown by the multi-value object, but re-throws
-any other exception.
-
-=head2 C<raw_clear_value>
+Don't use this role directly, use
+L<Data::MultiValued::AttributeTrait::Tags>,
+L<Data::MultiValued::AttributeTrait::Ranges> or
+L<Data::MultiValued::AttributeTrait::TagsAndRanges>.
-Clears the instance slot. Does the same as
-L<Moose::Meta::Attribute/clear_value>, but we need this method because
-the other one gets changed by this trait.
-
-=head2 C<store_multi_value>
-
-Gets the value from the regular slot in the instance, and stores it
-into the multi-value object.
-
-=head2 C<get_value>
+This role (together with L<Data::MultiValued::AttributeAccessors>)
+defines all the basic plumbing to glue C<Data::MultiValued::Tags> etc
+into Moose attributes.
-Before the normal method, calls L</load_multi_value>. Normally, no
-options will be passed to the multi-value object C<get> method.
+=head1 ATTRIBUTES
-=head2 C<get_multi_value>
+=head2 C<full_storage_slot>
-Sets the options that L</load_multi_value> will use, then calls L</get_value>.
+The instance slot to use to store the C<Data::MultiValued::Tags> or
+similar object. Defaults to C<"${name}__MULTIVALUED_STORAGE__">, where
+C<$name> is the attribute name.
-The options are passed via an ugly C<local>ised package
-variable. There might be a better way.
+=head2 C<multi_accessor>
-=head2 C<set_initial_value>
+=head2 C<multi_reader>
-After the normal method, calls L</store_multi_value>.
+=head2 C<multi_writer>
-=head2 C<set_value>
+=head2 C<multi_predicate>
-=head2 C<set_multi_value>
+=head2 C<multi_clearer>
-Just like L</get_value> and L</get_multi_value>, but calling
-L</store_multi_value> after the regular C<set_value>
+The names to use for the various additional accessors. See
+L<Class::MOP::Attribute> for details. These default to
+C<"${name}_multi"> where C<$name> is the name of the corresponding
+non-multi accessor. So, for example,
-=head2 C<has_value>
+ has stuff => (
+ is => 'rw',
+ traits => ['MultiValued::Tags'],
+ );
-=head2 C<has_multi_value>
+will create a C<stuff> read / write accessor and a C<stuff_multi> read
+/ write tagged accessor.
-Just like L</get_value> and L</get_multi_value>.
+=head1 ATTRIBUTES
-=head2 C<clear_value>
+=head2 C<full_storage_slot>
-=head2 C<clear_multi_value>
+The instance slot to use to store the C<Data::MultiValued::Tags> or
+similar object. Defaults to C<"${name}__MULTIVALUED_STORAGE__">, where
+C<$name> is the attribute name.
-Call the C<clear> method on the multi-value object.
+=head2 C<multi_accessor>
-=head2 C<get_multi_read_method>
+=head2 C<multi_reader>
-=head2 C<get_multi_write_method>
+=head2 C<multi_writer>
-Return the name of the reader or writer method, honoring
-L</multi_reader>, L</multi_writer> and L</multi_accessor>.
+=head2 C<multi_predicate>
-=head2 C<_rebless_slot>
+=head2 C<multi_clearer>
-Blesses the value inside the L</full_storage_slot> of the instance
-into L</multivalue_storage_class>, then calls C<_rebless_storage> on
-it.
+The names to use for the various additional accessors. See
+L<Class::MOP::Attribute> for details. These default to
+C<"${name}_multi"> where C<$name> is the name of the corresponding
+non-multi accessor. So, for example,
-=head2 C<_as_hash>
+ has stuff => (
+ is => 'rw',
+ traits => ['MultiValued::Tags'],
+ );
-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
-does not have a value.
+will create a C<stuff> read / write accessor and a C<stuff_multi> read
+/ write tagged accessor.
-=head1 DESCRIPTION
+=head1 METHODS
=head2 C<slots>
@@ -517,68 +476,6 @@ 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
does not have a value.
-=head1 ATTRIBUTES
-
-=head2 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
-C<$name> is the attribute name.
-
-=head2 C<multi_accessor>
-
-=head2 C<multi_reader>
-
-=head2 C<multi_writer>
-
-=head2 C<multi_predicate>
-
-=head2 C<multi_clearer>
-
-The names to use for the various additional accessors. See
-L<Class::MOP::Attribute> for details. These default to
-C<"${name}_multi"> where C<$name> is the name of the corresponding
-non-multi accessor. So, for example,
-
- has stuff => (
- is => 'rw',
- traits => ['MultiValued::Tags'],
- );
-
-will create a C<stuff> read / write accessor and a C<stuff_multi> read
-/ write tagged accessor.
-
-=head1 ATTRIBUTES
-
-=head2 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
-C<$name> is the attribute name.
-
-=head2 C<multi_accessor>
-
-=head2 C<multi_reader>
-
-=head2 C<multi_writer>
-
-=head2 C<multi_predicate>
-
-=head2 C<multi_clearer>
-
-The names to use for the various additional accessors. See
-L<Class::MOP::Attribute> for details. These default to
-C<"${name}_multi"> where C<$name> is the name of the corresponding
-non-multi accessor. So, for example,
-
- has stuff => (
- is => 'rw',
- traits => ['MultiValued::Tags'],
- );
-
-will create a C<stuff> read / write accessor and a C<stuff_multi> read
-/ write tagged accessor.
-
=head1 Implementation details
The multi-value object is stored in the instance slot named by the