From 6e5e90bf9e77324bb8a3455950a81c2abe626400 Mon Sep 17 00:00:00 2001 From: Gianni Ceccarelli Date: Thu, 24 Nov 2011 17:59:04 +0000 Subject: make PAUSE life easier --- Changes | 2 -- dist.ini | 2 +- lib/Data/MultiValued.pm | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ lib/Data/MultiValued.pod | 70 -------------------------------------------- 4 files changed, 77 insertions(+), 73 deletions(-) create mode 100644 lib/Data/MultiValued.pm delete mode 100644 lib/Data/MultiValued.pod diff --git a/Changes b/Changes index 2b12ca7..3d14c89 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,4 @@ Revision history for Data::MultiValued {{$NEXT}} - -0.0.1 2011-11-22 15:35:03 Europe/London - first working version diff --git a/dist.ini b/dist.ini index e7ae0ae..6933499 100644 --- a/dist.ini +++ b/dist.ini @@ -6,7 +6,7 @@ copyright_year = 2011 abstract = Handle values with tags and validity ranges -main_module = lib/Data/MultiValued.pod +main_module = lib/Data/MultiValued.pm [GatherDir] diff --git a/lib/Data/MultiValued.pm b/lib/Data/MultiValued.pm new file mode 100644 index 0000000..aff7a17 --- /dev/null +++ b/lib/Data/MultiValued.pm @@ -0,0 +1,76 @@ +package Data::MultiValued; +use strict; +use warnings; +# ABSTRACT: store tag- and range-dependant data in a scalar or Moose attribute + +warn "Don't use this module directly, use Data::MultiValued::Tags or Data::MultiValued::Ranges or the like"; + +1; + +=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. + diff --git a/lib/Data/MultiValued.pod b/lib/Data/MultiValued.pod deleted file mode 100644 index ebae360..0000000 --- a/lib/Data/MultiValued.pod +++ /dev/null @@ -1,70 +0,0 @@ -# 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