Types::URI(3pm)

πŸ’– Types::URI πŸ’–

ok bestie, so this is Types::URI (that's the 3pm one, from the User Contributed Perl Documentation section β€” very demure, very CPAN). it's all about type constraints and coercions for URIs, and honestly? it's giving ✨structured data✨.


🌸 NAME 🌸

Types::URI β€” type constraints and coercions for URIs πŸ¦‹


✨ SYNOPSIS ✨

ok so picture this, you're writing a package and you want an attribute that's definitely a URI, no discussion:

package FroobleDocument;

use Moose;
use Types::URI -all;

has source => (
   is      => 'ro',
   isa     => Uri,
   coerce  => 1,
);

like. that's it. that's the whole vibe. Uri as the isa, coerce => 1 on, and your source attribute is now contractually obligated to be a URI. periodt πŸ’…


πŸ’œ DESCRIPTION πŸ’œ

Types::URI is a type constraint library β€” and it's built for hanging out with Moo/Moose attributes, Kavorka sub signatures, and all the other cool kids, so forth, etc. 🫢

πŸŽ€ Types πŸŽ€

this module serves up some type constraints that are broadly compatible with the ones MooseX::Types::URI gives you, plus a couple of extra type constraints of its own, because it's generous like that. πŸ’–

⭐ Uri

a class type for URI/URI::WithBase. here's everything it can coerce from:

  • from Uuid β€” coerces to a URI in the urn:uuid: schema. (See Types::UUID.)
  • from Str β€” uses new in URI.
  • from Path β€” uses new in URI::file. (See Types::Path::Tiny.)
  • from ScalarRef β€” uses new in URI::data.
  • from HashRef β€” coerces using URI::FromHash.
  • from Iri β€” uses new in URI.
  • from RDF::Trine::Node::Resource, RDF::Trine::Namespace, XML::Namespace β€” uses new in URI.

πŸ¦‹ FileUri

a subtype of Uri that covers URI::file. 🌈 here's what it eats:

  • from Str β€” uses new in URI::file.
  • from Path β€” uses new in URI::file. (See Types::Path::Tiny.)
  • from HashRef β€” coerces using URI::FromHash.
  • from Iri β€” uses new in URI.
  • from RDF::Trine::Node::Resource, RDF::Trine::Namespace, XML::Namespace β€” uses new in URI.

πŸ“ DataUri

a subtype of Uri that covers URI::data. πŸ’– the menu:

  • from Str β€” uses new in URI::data.
  • from ScalarRef β€” uses new in URI::data.
  • from HashRef β€” coerces using URI::FromHash.
  • from Iri β€” uses new in URI.
  • from RDF::Trine::Node::Resource, RDF::Trine::Namespace, XML::Namespace β€” uses new in URI.

🧚 Iri

a class type for IRI. coercions work exactly as per Uri up above πŸ‘†, plus it can also coerce from Uri. yeah, it does the whole circuit. πŸ”₯


πŸ’€ BUGS πŸ’€

found a bug? not the vibe, but ok, spill it here bestie: <http://rt.cpan.org/Dist/Display.html?Queue=Types-URI>. πŸ™ˆ


🌈 SEE ALSO 🌈

go read these too, they're iconic:

MooseX::Types::URI, Type::Tiny::Manual, URI, URI::file, URI::data, URI::FromHash, RDF::Trine::Node::Resource, IRI.

Types::UUID, Types::Path::Tiny, Types::Standard.


πŸ‘‘ AUTHOR πŸ‘‘

Toby Inkster <tobyink@cpan.org>. πŸ’…


This software is copyright (c) 2014 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. 🫢


πŸ™ˆ DISCLAIMER OF WARRANTIES πŸ™ˆ

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

like, no promises, bestie. none. zero. that's the whole clause. 😭


and that's the page!! this was Types::URI(3pm), perl v5.36.0, dated 2022-11-29 β€” you didn't hear it from me but that date is lowkey a whole vibe. go write some type constraints, you absolute main character. πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from