The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Data::Annotated - Data structure Annotation module

VERSION

Version 0.01

SYNOPSIS

    use Data::Annotated;

    my $da = Data::Annotated->new();
    
    $da->annotate('/foo/bar[2]/baz', {desc => 'this is an interesting field'});
    $da->annotate('/some/other/path', {test => 1, runthis => sub { print 'I was one'; } });
   
    my $struct = {some => {other => {path => 1}}}; 
    my @annotations = $da->cat_annotations();
    
    # this will print out "I was one';
    $annotations[0]{runthis}->() if $struct->{some}{other}{path} == $annotations[0]{test};

METHODS

new()

    instantiate a new Data::Annotated object;

annotate($path, \%annotation);

    Annotate a piece of a data structure. The path is an XPath like path like L<Data::Path>
    uses. The annotation can be any scalar value. Possible uses are String for descriptive
    text. Or a reference to a more complex data structure.

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.

AUTHOR

Jeremy Wall, <jeremy at marzhillstudios.com>

BUGS

Please report any bugs or feature requests to bug-data-annotated at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Data-Annotated. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

TODO

    Should Data::Annotate wrap data? or stay a collection of annotations?
    
    Make Data::Annotate return the data from a requested path.
    my $info = $da->get($path, $data) basically just a wrapper around L<Data::Path> get()

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Data::Annotated

You can also look for information at:

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2007 Jeremy Wall, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.