NAME

Data::HAL::Link - Hypertext Application Language link

VERSION

This document describes Data::HAL::Link version 1.000

SYNOPSIS

map { +{
    href => $_->href->uri->as_string,
    rel  => $_->relation->uri->as_string
} } @{ $resource->links }

DESCRIPTION

This section is completely quoted from the specification:

A Link Object represents a hyperlink from the containing resource to a URI.

INTERFACE

Composition

None.

Constructors

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.

Attributes

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

href

Type Data::HAL::URI, required, link target URI or URI template

templated

Type boolean, whether href is a URI template

Perl boolean values are coerced to the boolean type.

type

Type MIME::Type, media type of the href resource

deprecation

Type Data::HAL::URI, if existing indicates the link is deprecated

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

profile

Type Data::HAL::URI, RFC 6906 profile of the target resource

title

Type Str, labels the link with a human-readable identifier

hreflang

Type Str, indicates the language of the target resource

Methods

Returns the link as a RFC 5988 link-value string, e.g. </orders?page=2>;rel="next".

Exports

None.

DIAGNOSTICS

See "new" constructor.

CONFIGURATION AND ENVIRONMENT

Requires no configuration files or environment variables.