The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

MooseX::Extended::Types - Keep our type tools organized

VERSION

version 0.32

SYNOPSIS

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

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

As a convenience, if you're using MooseX::Extended, you can do this:

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

If you're brave:

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

But that exports everything and it's easy to have surprising conflicts.

DESCRIPTION

A basic set of useful types for MooseX::Extended, as provided by Type::Tiny. Using these is preferred to using using strings due to runtime versus compile-time failures. For example:

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

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

TYPE LIBRARIES

We automatically include the types from the following:

  • Types::Standard

    You can import them individually or 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 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 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 using the :all export tag (but 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>

COPYRIGHT AND LICENSE

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

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)