MooseX:...d::Types(3)

πŸ“¦
version 0.35 Β· 2 versions
, in fedora 43

🌸 NAME 🌸

MooseX::Extended::Types β€” bestie, it's literally just keeping our type tools organized. That's the whole job. And honestly? It eats. πŸ’…


πŸŽ€ VERSION πŸŽ€

version 0.35. Yes queen, we're on 0.35. ✨


✨ SYNOPSIS ✨

Okay so, the classic entrance:

use MooseX::Extended;
use MooseX::Extended::Types;

use MooseX::Extended::Types qw(
  ArrayRef
  Dict
  Enum
  HashRef
  InstanceOf
  Str
  compile
);

Now as a little treat β€” a convenience, if you will β€” if you're already using MooseX::Extended, you can just do this instead:

use MooseX::Extended types => [qw(
  ArrayRef
  Dict
  Enum
  HashRef
  InstanceOf
  Str
  compile
)];

And if you're brave (or unhinged, no judgment 🫢):

use MooseX::Extended types => ':all';

But just so you know β€” that exports everything, and it's super easy to end up with surprising conflicts. So maybe don't. 😭


πŸ’… DESCRIPTION πŸ’…

A basic set of useful types for "MooseX::Extended", as provided by Type::Tiny. Using these is preferred to using strings, and the reason is runtime versus compile-time failures. Like, would you rather find out at 3am in prod or while you're still typing? Exactly. For example:

# fails at runtime, if ->name is set
param name => ( isa => 'str' );

# fails at compile-time
param name => ( isa => str );

See how the second one is giving caught immediately energy? That's the one. πŸ‘‘


πŸ¦‹ TYPE LIBRARIES πŸ¦‹

We automatically include the types from the following:

  • Types::Standard 🌈

You can import them individually, or grab them all with the ":Standard" tag:

use MooseX::Extended::Types types => 'Str';
use MooseX::Extended::Types types => [ 'Str', 'ArrayRef' ];
use MooseX::Extended::Types types => ':Standard';

Using the ":Standard" tag is equivalent to:

use Types::Standard;

No import list is supplied directly to the module, so non-default type functions must be asked for by name.

  • Types::Common::Numeric πŸ”’

You can import them individually, or grab them all with the ":Numeric" tag:

use MooseX::Extended::Types types => 'Int';
use MooseX::Extended::Types types => [ 'Int', 'NegativeOrZeroNum' ];
use MooseX::Extended::Types types => ':Numeric';

Using the ":Numeric" tag is equivalent to:

use Types::Common::Numeric;

No import list is supplied directly to the module, so non-default type functions must be asked for by name.

  • Types::Common::String πŸŽ€

You can import them individually, or grab them all with the ":String" tag:

use MooseX::Extended::Types types => 'NonEmptyStr';
use MooseX::Extended::Types types => [ 'NonEmptyStr', 'UpperCaseStr' ];
use MooseX::Extended::Types types => ':String';

Using the ":String" tag is equivalent to:

use Types::Common::String;

No import list is supplied directly to the module, so non-default type functions must be asked for by name.


πŸ”₯ EXTRAS πŸ”₯

The following extra functions are exported on demand, or if you're using the ":all" export tag β€” but honestly bestie, you probably don't want to use that tag. πŸ™ˆ

Type::Params

  • "compile"
  • "compile_named"
  • "multisig"
  • "validate"
  • "validate_named"
  • "compile_named_oo"
  • "Invocant"
  • "wrap_subs"
  • "wrap_methods"
  • "ArgsObject"

Types::Standard

  • "slurpy"

πŸ‘‘ AUTHOR πŸ‘‘

Curtis "Ovid" Poe <curtis.poe@gmail.com>


This software is Copyright (c) 2022 by Curtis "Ovid" Poe.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

And that's the whole page, babes β€” written for perl v5.42.0, dated 2025-07-25. Go forth and type-check your little heart out. πŸ’–βœ¨

πŸ“¦ where this page comes from