On Wed, Oct 24, 2012 at 07:49:37AM +1100, Alfie John wrote: > On Tue, Oct 23, 2012 at 04:37:31PM +0100, Matt S Trout wrote: > > On Tue, Oct 23, 2012 at 08:29:47PM +1100, Alfie John wrote: > > > Any objection to Data::Tree? I could then rename the description to: > > > > > > Data::Tree - Navigate and manipulate data structures like a tree > > > > > > Otherwise, I'd be willing to hear some suggestions. > > > > I can't really make a suggestion if you don't show any examples of usage. > > Here's the SYNOPSIS: > > use Data::PathSimple qw{ > get > set > }; > > my $data = { > Languages => { > Perl => { > CurrentVersion => '5.16.1', > URLs => [ > 'http://www.perl.org', > 'http://www.cpan.org', > ], > }, > PHP => { > CurrentVersion => '5.4.7', > URLs => [ > 'http://www.php.net', > 'http://pear.php.net', > ], > }, > Python => { > CurrentVersion => '2.7.3', > URLs => [ > 'http://www.python.org', > ], > }, > }, > }; > > my $current_perl = get( $data, '/Languages/Perl/CurrentVersion' ); > my @perl_urls = @{ get( $data, '/Languages/Perl/URLs' ) || [] }; > > set( $data, '/Languages/Perl/CurrentVersion', '5.16.2' ); > set( $data, '/Languages/Python/URLs/1/', 'http://pypi.python.org' ); > > > What distinguishes it from Data::SPath? From Data::DPath? From straight up > > XPath matching using an adaptor like Class::XPath? > > First off, Data::SPath, Data::Dpan and Class::XPath only allow getting. My > module does setting too. > > As you can see from the code above, the way you access the data that you want > is by *simple* paths. If you have a look at Data::DPath and Class::XPath, they > take complex paths and are used to match across the entire data structure. > That's not what my module is about. Mine is about access the specific part of > the data structure that you're after.
Data::Selector ? You probably also want to provide alternative names to get() and set() - those are way way too commonly already in use in existing code. -- Matt S Trout - Shadowcat Systems - Perl consulting with a commit bit and a clue http://shadowcat.co.uk/blog/matt-s-trout/ http://twitter.com/shadowcat_mst/ Email me now on mst (at) shadowcat.co.uk and let's chat about how our Catalyst commercial support, training and consultancy packages could help your team.