Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

mojo::json::pointer(3pm) [debian man page]

Mojo::JSON::Pointer(3pm)				User Contributed Perl Documentation				  Mojo::JSON::Pointer(3pm)

NAME
Mojo::JSON::Pointer - JSON Pointers SYNOPSIS
use Mojo::JSON::Pointer; my $p = Mojo::JSON::Pointer->new; say $p->get({foo => [23, 'bar']}, '/foo/1'); say 'Contains "/foo".' if $p->contains({foo => [23, 'bar']}, '/foo'); DESCRIPTION
Mojo::JSON::Pointer implements JSON Pointers as described in http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer <http://tools.ietf.org/html/draft-ietf-appsawg-json-pointer>. METHODS
"contains" my $success = $p->contains($data, '/foo/1'); Check if data structure contains a value that can be identified with the given JSON Pointer. # True $p->contains({foo => 'bar', baz => [4, 5, 6]}, '/foo'); $p->contains({foo => 'bar', baz => [4, 5, 6]}, '/baz/2'); # False $p->contains({foo => 'bar', baz => [4, 5, 6]}, '/bar'); $p->contains({foo => 'bar', baz => [4, 5, 6]}, '/baz/9'); "get" my $value = $p->get($data, '/foo/bar'); Extract value identified by the given JSON Pointer. # "bar" $p->get({foo => 'bar', baz => [4, 5, 6]}, '/foo'); # "4" $p->get({foo => 'bar', baz => [4, 5, 6]}, '/baz/0'); # "6" $p->get({foo => 'bar', baz => [4, 5, 6]}, '/baz/2'); SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojo::JSON::Pointer(3pm)

Check Out this Related Man Page

Mojo::Path(3pm) 					User Contributed Perl Documentation					   Mojo::Path(3pm)

NAME
Mojo::Path - Path SYNOPSIS
use Mojo::Path; my $path = Mojo::Path->new('/foo%2Fbar%3B/baz.html'); shift @{$path->parts}; say $path; DESCRIPTION
Mojo::Path is a container for URL paths. ATTRIBUTES
Mojo::Path implements the following attributes. "leading_slash" my $leading_slash = $path->leading_slash; $path = $path->leading_slash(1); Path has a leading slash. "parts" my $parts = $path->parts; $path = $path->parts([qw(foo bar baz)]); The path parts. # Part with slash push @{$path->parts}, 'foo/bar'; "trailing_slash" my $trailing_slash = $path->trailing_slash; $path = $path->trailing_slash(1); Path has a trailing slash. METHODS
Mojo::Path inherits all methods from Mojo::Base and implements the following new ones. "new" my $path = Mojo::Path->new; my $path = Mojo::Path->new('/foo%2Fbar%3B/baz.html'); Construct a new Mojo::Path object. "canonicalize" $path = $path->canonicalize; Canonicalize path. # "/foo/baz" Mojo::Path->new('/foo/bar/../baz')->canonicalize; "clone" my $clone = $path->clone; Clone path. "contains" my $success = $path->contains('/foo'); Check if path contains given prefix. # True Mojo::Path->new('/foo/bar')->contains('/'); Mojo::Path->new('/foo/bar')->contains('/foo'); Mojo::Path->new('/foo/bar')->contains('/foo/bar'); # False Mojo::Path->new('/foo/bar')->contains('/f'); Mojo::Path->new('/foo/bar')->contains('/bar'); Mojo::Path->new('/foo/bar')->contains('/whatever'); "merge" $path = $path->merge('/foo/bar'); $path = $path->merge('foo/bar'); $path = $path->merge(Mojo::Path->new('foo/bar')); Merge paths. # "/baz/yada" Mojo::Path->new('/foo/bar')->merge('/baz/yada'); # "/foo/baz/yada" Mojo::Path->new('/foo/bar')->merge('baz/yada'); # "/foo/bar/baz/yada" Mojo::Path->new('/foo/bar/')->merge('baz/yada'); "parse" $path = $path->parse('/foo%2Fbar%3B/baz.html'); Parse path. Note that %2F will be treated as "/" for security reasons. "to_abs_string" my $string = $path->to_abs_string; Turn path into an absolute string. "to_string" my $string = $path->to_string; Turn path into a string. SEE ALSO
Mojolicious, Mojolicious::Guides, <http://mojolicio.us>. perl v5.14.2 2012-09-05 Mojo::Path(3pm)
Man Page