From 5dbdfc53752cd050b171f416ea3625b18e4018b8 Mon Sep 17 00:00:00 2001 From: Gianni Ceccarelli Date: Mon, 14 Nov 2011 14:48:16 +0000 Subject: some docs --- lib/Data/MultiValued.pod | 70 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 lib/Data/MultiValued.pod (limited to 'lib/Data/MultiValued.pod') diff --git a/lib/Data/MultiValued.pod b/lib/Data/MultiValued.pod new file mode 100644 index 0000000..ebae360 --- /dev/null +++ b/lib/Data/MultiValued.pod @@ -0,0 +1,70 @@ +# PODNAME: Data::MultiValued +# ABSTRACT: store tag- and range-dependant data in a scalar or Moose attribute + +=head1 SYNOPSIS + + use Data::MultiValued::Tags; + + my $obj = Data::MultiValued::Tags->new(); + $obj->set({ + tag => 'tag1', + value => 'a string', + }); + say $obj->get({tag=>'tag1'}); # prints 'a string' + say $obj->get({tag=>'tag2'}); # dies + +Also: + + package My::Class; + use Moose; + use Data::MultiValued::AttributeTrait::Tags; + + has stuff => ( + is => 'rw', + isa => 'Int', + traits => ['MultiValued::Tags'], + ); + + # later + + my $obj = My::Class->new(); + $obj->stuff_multi({tag=>'tag1'},123); + say $obj->stuff_multi({tag=>'tag1'}); # prints 123 + +=head1 DESCRIPTION + +This set of classes allows you to store different values inside a +single object, and access them by tag and / or by a numeric value. + +Yes, you could do the same with hashes and some clever use of +arrays. Or you could use L. Or some other CPAN +module. Why use these? + +=over 4 + +=item * + +they are optimised for serialisation, see +L and F. + +=item * + +you get accessors generated for your Moose attributes just by setting +a trait + +=item * + +tags and ranges interact in sensible ways, including clearing ranges + +=back + +=head1 Where to go from here + +Look at the tests for detailed examples of usage. Look at +L, L and +L for the containers +themselves. Look at L, +L and +L for the Moose +attribute traits. + -- cgit v1.2.3