Data-Annotated
view release on metacpan or search on metacpan
lib/Data/Annotated.pm view on Meta::CPAN
Data::Annotated - Data structure Annotation module
=head1 VERSION
Version 0.01
=cut
our $VERSION = '0.2';
my $callbacks = {
key_does_not_exist => sub {},
index_does_not_exist => sub {},
retrieve_index_from_non_array => sub {},
retrieve_key_from_non_hash => sub {},
};
=head1 SYNOPSIS
use Data::Annotated;
lib/Data/Annotated.pm view on Meta::CPAN
=head2 cat_annotation($data)
spit out the annotations for a data structure. Returns the annotations that apply
for the passed in data structures. Does not return an annotation if the data doesn't
contain the data location it is matched to.
=cut
sub cat_annotation {
my ($self, $data) = @_;
my $dp = Data::Path->new($data, $callbacks);
my @paths = grep { $dp->get($_) } keys(%$self);
return map { $self->get_annotation($_) } @paths;
}
=head2 get_annotation($path);
retrieves an annotation keyed by the path in the data structure.
=cut
( run in 0.244 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )