MooseX:...es::Perl(3)

πŸ¦‹ MooseX::Types::Perl πŸ¦‹

Okay bestie, you're reading the manual page MooseX:...es::Perl(3) from User Contributed Perl Documentation, and the actual module is MooseX::Types::Perl. It's literally about Moose types that vibe-check your Perl syntax. ✨


πŸ’– NAME πŸ’–

MooseX::Types::Perl β€” Moose types that check against Perl syntax. Periodt. πŸ’…

✨ VERSION ✨

Version 0.101344, and yes that's the whole mood. πŸŽ€

πŸŽ€ SYNOPSIS πŸŽ€

Import the squad like this:

  use MooseX::Types::Perl qw(
    DistName

    ModuleName
    PackageName

    Identifier
    SafeIdentifier

    LaxVersionStr
    StrictVersionStr
    VersionObject
  );

🌸 DESCRIPTION 🌸

This library hands you Moose types for checking things (mostly strings) against syntax that is β€” or is a reasonable subset of β€” Perl syntax. It's giving syntax bouncer at the club, no cap. πŸ’…

🧚 PERL VERSION 🧚

This library should run on perls released even a long time ago. It should work on any version of perl released in the last five years. 🫢

Although it may work on older versions of perl, no guarantee is made that the minimum required version will not be increased. The version may be increased for any reason, and there is no promise that patches will be accepted to lower the minimum required perl. So like… don't come for it. πŸ™ˆ

πŸ‘‘ TYPES πŸ‘‘

🧩 ModuleName / PackageName 🧩

These types are identical, bestie β€” they expect a string that could be a package or module name. That's basically a bunch of identifiers stuck together with double-colons. One key quirk: parts of the package name after the first may begin with digits. πŸ‘€

⚠️ The use of an apostrophe as a package separator is not permitted. Hard no. 🚫

πŸ“¦ DistName πŸ“¦

The DistName type checks for a string like MooseX-Types-Perl β€” the sort of thing used to name CPAN distributions. In general, it's like the more familiar ModuleName, but with hyphens instead of double-colons. Slay. πŸ’–

In reality, a few distribution names may not match this pattern β€” most famously, CGI.pm is the name of the distribution that contains CGI. These exceptions are few and far between, and deciding what a LaxDistName type would look like has not seemed worth it, yet. πŸ¦‹

🏷️ Identifier 🏷️

An Identifier is something that could be used as a symbol name or other identifier (filehandle, directory handle, subroutine name, format name, or label). It's what you put after the sigil (dollar sign, at sign, percent sign) in a variable name. Generally, it's a bunch of alphanumeric characters not starting with a digit. Iconic. ⭐

Although Perl identifiers may contain non-ASCII characters in some circumstances, this type does not allow it. A UnicodeIdentifier type may be added in the future. 🌈

πŸ›‘οΈ SafeIdentifier πŸ›‘οΈ

SafeIdentifiers are just like Identifiers, but they omit the single-letter variables underscore, a, and b, as these have special significance. Respect the special ones. πŸ™ˆ

🎚️ LaxVersionStr / StrictVersionStr 🎚️

Lax and strict version strings use the is_lax and is_strict methods from version to check if the given string would be a valid lax or strict version. version::Internals covers the details, but basically: lax versions are everything you may do, and strict omit many of the usages best avoided. Lowkey deep. 🌊

🧬 VersionObject 🧬

Just for good measure, this type is included to check if a value is a version object. Coercions from LaxVersionStr (and thus StrictVersionStr) are provided. Cute. πŸŽ€

🌟 AUTHOR 🌟

Ricardo SIGNES <cpan@semiotic.systems> β€” the author, the icon. πŸ‘‘

🫢 CONTRIBUTORS 🫢

  • Karen Etheridge <ether@cpan.org> πŸ’œ
  • Ricardo Signes <rjbs@semiotic.systems> 🌸

This software is copyright (c) 2022 by Ricardo SIGNES.

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


Cute sign-off: this page is from perl v5.42.0, dated 2023-01-02, and it's the MooseX:...es::Perl(3) manual. Bye bestie β€” go check those types! πŸ’œ

πŸ“¦ where this page comes from