Data::HAL::Link(3pm)

πŸ“¦
version 1.001 Β· 3 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

okay so bestie, welcome to Data::HAL::Link from the Data::HAL family. This is a Perl thing. It's a link object. It's giving "structured hypermedia" and honestly? It ate. Let's get into it 🫢


✨ VERSION ✨

This doc is describing Data::HAL::Link version 1.001. Yes queen, that's the one. πŸ’…


🌸 SYNOPSIS 🌸

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

look at her go. that's the whole flex. ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so this next bit? This is completely quoted from the specification β€” not me, not the author, the spec said it first:

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

periodt. that's the definition. iconic. 😌


πŸ‘‘ INTERFACE πŸ‘‘

πŸŽ€ Composition πŸŽ€

None.

like... nothing. zero. empty. it's an independent girlboss, no parent classes, no role drama. πŸ™ˆ

πŸ’œ Constructors πŸ’œ

  • new β€” the glow-up moment where your object gets born 🌱

So here's the tea on this one: when the deprecation attribute is set, the constructor logs a Log::Any warning. And the warning is literally this string, verbatim:

"The link (relation: "%s", href: "%s") is deprecated, see <%s>"

You can absolutely consume that warning with a Log::Any::Adapter of your choosing, bestie β€” your logs, your rules. For example:

    use Log::Any::Adapter 'Stderr';

Otherwise β€” meaning if deprecation isn't set β€” the constructor just behaves like the default Moo constructor. Chill. Normal. No notes. It returns a Data::HAL::Link object. πŸ’–

🌈 Attributes 🌈

Before we go attribute by attribute: Perl strings are coerced to the Data::HAL::URI type in the attributes relation, href, deprecation, and profile. So you can hand her a plain string and she'll handle the conversion herself. queen behavior. πŸ‘‘

also! Perl boolean values are coerced to the boolean type. no cap. ✨

heads up bestie: setting this attribute triggers a log message in the constructor new. that's the warning from up above. you've been warned fr fr 😭

🧚 Methods 🧚

"</orders?page=2>;rel="next""

that's the little string format. slay. 🌿

πŸ“ Exports πŸ“

None.

nothing gets exported. no surprise symbols landing in your namespace. it's giving boundaries. πŸ’œ


😭 DIAGNOSTICS 😭

Go look at the new constructor, bestie β€” that's where the warning lives. (See "new" constructor.)


🌟 CONFIGURATION AND ENVIRONMENT 🌟

Requires no configuration files or environment variables.

none. zero. nada. it just works. aesthetic. ✨


and that's the whole page!! πŸ’– huge thanks to the perl crew β€” this doc shipped with perl v5.36.0 and the page itself is dated 2022-08-28, under the Data::HAL::Link(3pm) manual. go forth and hyperlink responsibly, bestie. mwah πŸ«ΆπŸ’…πŸŒˆ

πŸ“¦ where this page comes from