summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGianni Ceccarelli <dakkar@thenautilus.net>2011-11-14 14:25:18 +0000
committerGianni Ceccarelli <dakkar@thenautilus.net>2011-11-14 14:25:18 +0000
commit555cdcf7cecd740e08df7ba353a43b1793b084b8 (patch)
tree41cc72c2882c1e8e686f7868c0c809f3c8f4e66a
parentBuild results of dd15e2e (on master) (diff)
parentfix inserting range w/o overlap (diff)
downloaddata-multivalued-555cdcf7cecd740e08df7ba353a43b1793b084b8.tar.gz
data-multivalued-555cdcf7cecd740e08df7ba353a43b1793b084b8.tar.bz2
data-multivalued-555cdcf7cecd740e08df7ba353a43b1793b084b8.zip
Build results of dd15e2e (on master)
-rw-r--r--Changes2
-rw-r--r--lib/Data/MultiValued/Tags.pm51
2 files changed, 52 insertions, 1 deletions
diff --git a/Changes b/Changes
index a8aa1c3..5296e47 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
Revision history for Data::MultiValued
-0.0.1 2011-11-14 14:17:16 Europe/London
+0.0.1 2011-11-14 14:25:12 Europe/London
- first working version
diff --git a/lib/Data/MultiValued/Tags.pm b/lib/Data/MultiValued/Tags.pm
index 51f7cdb..7295db8 100644
--- a/lib/Data/MultiValued/Tags.pm
+++ b/lib/Data/MultiValued/Tags.pm
@@ -14,6 +14,7 @@ use Data::MultiValued::TagContainer;
# ABSTRACT: Handle values with tags and validity ranges
+
has _storage => (
is => 'rw',
isa => class_type('Data::MultiValued::TagContainer'),
@@ -38,6 +39,7 @@ sub _as_hash {
return {_storage=>\%ret};
}
+
sub set {
my ($self,%args) = validated_hash(
\@_,
@@ -49,6 +51,7 @@ sub set {
->{value} = $args{value};
}
+
sub get {
my ($self,%args) = validated_hash(
\@_,
@@ -59,6 +62,7 @@ sub get {
->{value};
}
+
sub clear {
my ($self,%args) = validated_hash(
\@_,
@@ -68,6 +72,7 @@ sub clear {
$self->_storage->clear(\%args);
}
+
1;
__END__
@@ -81,6 +86,52 @@ Data::MultiValued::Tags - Handle values with tags and validity ranges
version 0.0.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
+
+=head1 METHODS
+
+=head2 C<set>
+
+ $obj->set({ tag => $the_tag, value => $the_value });
+
+Stores the given value for the given tag. Replaces existing
+values. Does not throw exceptions.
+
+No cloning is done: if you pass in a reference, the reference is
+just stored.
+
+=head2 C<get>
+
+ my $value = $obj->get({ tag => $the_tag });
+
+Retrieves the value for the given tag. Throws a
+L<Data::MultiValued::Exceptions::TagNotFound> exception it the tag
+does not exists in this object.
+
+No cloning is done: if a reference was stored, you get it back
+untouched.
+
+=head2 C<clear>
+
+ $obj->clear({ tag => $the_tag });
+
+Deletes the given tag and all data associated with it. Does not throw
+exceptions: if the tag does not exist, nothing happens.
+
+=head1 SEE ALSO
+
+L<Data::MultiValued::TagContainer>, L<Data::MultiValued::Exceptions>
+
=head1 AUTHOR
Gianni Ceccarelli <dakkar@thenautilus.net>