Commits

Toby Inkster committed 7237ef8

doc fixes

Comments (0)

Files changed (2)

 no warnings;
 
 our $AUTHORITY = 'cpan:TOBYINK';
-our $VERSION   = '0.202';
+our $VERSION   = '0.203';
 our $Safe      = 1;
 
 use Carp;
 	no warnings;
 	
 	our $AUTHORITY = 'cpan:TOBYINK';
-	our $VERSION   = '0.202';
+	our $VERSION   = '0.203';
 	
 	use Carp;
 	use Scalar::Util qw[blessed];
   },
  };
  
- # All authors of books in the store
- my $jpath   = JSON::Path->new('$.store.book[*].author');
- my @authors = $jpath->values($data);
+ # All books in the store
+ my $jpath   = JSON::Path->new('$.store.book[*]');
+ my @books   = $jpath->values($data);
  
  # The author of the last (by order) book
- my $jpath   = JSON::Path->new('$..book[-1:]');
+ my $jpath   = JSON::Path->new('$..book[-1:].author');
  my $tolkien = $jpath->value($data);
+ 
+ # Convert all authors to uppercase
+ use JSON::Path 'jpath_map';
+ jpath_map { uc $_ } $object, '$.store.book[*].author';
 
 =head1 DESCRIPTION
 
 Like C<values>, but returns just the first value. This method is an lvalue
 sub, which means you can assign to it:
 
-  $path->values('$.name') = 'Bob';
+  $path->value('$.name') = 'Bob';
 
 =item C<<  paths($object)  >>
 
 
 =item C<< jpath($object, $path_string) >>
 
-Shortcut for C<< JSON::Path->new($path_string)->values($object) >>. That is,
-it can be used as an lvalue.
+Shortcut for C<< JSON::Path->new($path_string)->values($object) >>.
 
 =item C<< jpath1($object, $path_string) >>
 
-Shortcut for C<< JSON::Path->new($path_string)->value($object) >>. That is,
-it can be used as an lvalue.
+Shortcut for C<< JSON::Path->new($path_string)->value($object) >>.
+Like C<value>, it can be used as an lvalue.
 
 =item C<< jpath_map { CODE } $object, $path_string >>
 

meta/changes.pret

 		item "'jpath', 'jpath1' and 'jpath_map' functions."^^Addition;
 	].
 
+`JSON-Path 0.203 cpan:TOBYINK`
+	issued  2012-10-12;
+	changeset [
+		item "Minor corrections to pod."^^Documentation;
+	].
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.