Data::HAL::Link(3pm) | User Contributed Perl Documentation | Data::HAL::Link(3pm) |
Data::HAL::Link - Hypertext Application Language link
This document describes Data::HAL::Link version 1.000
map { +{ href => $_->href->uri->as_string, rel => $_->relation->uri->as_string } } @{ $resource->links }
This section is completely quoted from the specification:
A Link Object represents a hyperlink from the containing resource to a URI.
None.
"new"
When the "deprecation" attribute is set, the constructor logs a Log::Any warning:
"The link (relation: "%s", href: "%s") is deprecated, see <%s>"
You can consume it with a Log::Any::Adapter of your choice, e.g.
use Log::Any::Adapter 'Stderr';
Otherwise the constructor behaves like the default Moo constructor. Returns a "Data::HAL::Link" object.
Perl strings are coerced to the Data::HAL::URI type in the attributes "relation", "href", "deprecation", "profile".
"relation"
Type Data::HAL::URI, required, link relation <http://tools.ietf.org/html/draft-kelly-json-hal#section-8.2>
"href"
Type Data::HAL::URI, required, link target URI or URI template <http://tools.ietf.org/html/draft-kelly-json-hal#section-5.1>
"templated"
Type boolean, whether "href" is a URI template <http://tools.ietf.org/html/draft-kelly-json-hal#section-5.2>
Perl boolean values are coerced to the boolean type.
"type"
Type MIME::Type, media type of the "href" resource <http://tools.ietf.org/html/draft-kelly-json-hal#section-5.3>
"deprecation"
Type Data::HAL::URI, if existing indicates the link is deprecated <http://tools.ietf.org/html/draft-kelly-json-hal#section-5.4>
Setting the attribute triggers a log message in the constructor "new".
"name"
Type "Str", secondary key for selecting link objects which share the same relation type <http://tools.ietf.org/html/draft-kelly-json-hal#section-5.5>
"profile"
Type Data::HAL::URI, RFC 6906 profile of the target resource <http://tools.ietf.org/html/draft-kelly-json-hal#section-5.6>
"title"
Type "Str", labels the link with a human-readable identifier <http://tools.ietf.org/html/draft-kelly-json-hal#section-5.7>
"hreflang"
Type "Str", indicates the language of the target resource <http://tools.ietf.org/html/draft-kelly-json-hal#section-5.8>
"as_http_link_value"
Returns the link as a RFC 5988 "link-value" <http://tools.ietf.org/html/rfc5988#section-5> string, e.g. "</orders?page=2>;rel="next"".
None.
See "new" constructor.
Requires no configuration files or environment variables.
2015-12-25 | perl v5.22.1 |