MooseX::Types::LoadableClass(3pm)

MooseX::Types::LoadableClass3pm

Classname type constraint with coercion to load the class.

Usage

    package MyClass;
    use Moose;
    use MooseX::Types::LoadableClass qw/ LoadableClass /;
    has foobar_class => (
        is => 'ro',
        required => 1,
        isa => LoadableClass,
    );
    MyClass->new(foobar_class => 'FooBar'); # FooBar.pm is loaded or an
                                            # exception is thrown.

Version

version 0.016

Overview

    use Moose::Util::TypeConstraints;
    my $tc = subtype as ClassName;
    coerce $tc, from Str, via { Class::Load::load_class($_); $_ };

I've written those three lines of code quite a lot of times, in quite a lot of places.

Now I don't have to.

Types exported

"LoadableClass"

A normal class / package.

"LoadableRole"

Like "LoadableClass", except the loaded package must be a Moose::Role.

Support

Bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Types-LoadableClass> (or [email protected] <mailto:[email protected]>).

There is also a mailing list available for users of this distribution, at <http://lists.perl.org/list/moose.html>.

There is also an irc channel available for users of this distribution, at "#moose" on "irc.perl.org" <irc://irc.perl.org/#moose>.

Contributors

•

Karen Etheridge <[email protected]>

•

Dagfinn Ilmari Mannsåker <[email protected]>

•

Florian Ragwitz <[email protected]>

•

Graham Knop <[email protected]>

•

Gregory Oschwald <[email protected]>

•

Сергей Романов <[email protected]>

Releases

7 releases since Debian 7 (Wheezy); the text changed 5 times.

  1. 7
  2. 8
  3. 9
  4. 10–11
  5. 12
  6. 13

Author

Tomas Doran <[email protected]>

From libmoosex-types-loadableclass-perl 0.016-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.