Scroll to navigation

JSON::Validator::URI(3pm) User Contributed Perl Documentation JSON::Validator::URI(3pm)

NAME

JSON::Validator::URI - Uniform Resource Identifier

SYNOPSIS

  use JSON::Validator::URI;
  my $urn = JSON::Validator::URI->new('urn:uuid:ee564b8a-7a87-4125-8c96-e9f123d6766f');
  my $url = JSON::Validator::URI->new('/foo');
  my $url = JSON::Validator::URI->new('https://mojolicious.org');

DESCRIPTION

JSON::Validator::URI is a class for presenting both URL and URN.

This class is currently EXPERIMENTAL.

EXPORTED FUNCTIONS

uri

  $uri = uri;
  $uri = uri $orig, $base;

Returns a new JSON::Validator::URI object from $orig and $base. Both variables can be either a string or a JSON::Validator::URI object.

ATTRIBUTES

JSON::Validator::URI inherits all attributes from Mojo::URL and implements the following ones.

nid

  $str = $uri->nid;

Returns the NID part of a URN. Example "uuid" or "iban".

nss

  $str = $uri->nss;

Returns the NSS part of a URN. Example "6e8bc430-9c3a-11d9-9669-0800200c9a66".

METHODS

JSON::Validator::URI inherits all methods from Mojo::URL and implements the following ones.

from_data

  $str = $uri->from_data($data);

This method will generate a URN for $data. $data will be serialized using "encode_json" in Mojo::JSON before being used to generate an UUIDv5.

This method is EXPERIMENTAL and subject to change!

parse

See "parse" in Mojo::URL.

to_abs

See "to_abs" in Mojo::URL.

to_string

See "to_string" in Mojo::URL.

to_unsafe_string

See "to_unsafe_string" in Mojo::URL.

SEE ALSO

JSON::Validator.

2024-12-12 perl v5.40.0