-
-
16 Jun 2017 23:39:16 UTC
- Distribution: MooseX-Types-LoadableClass
- Module version: 0.015
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues (0)
- Testers (4647 / 0 / 0)
- Kwalitee
Bus factor: 8- 100.00% Coverage
- License: perl_5
- Perl: v5.6.0
- Activity
24 month- Tools
- Download (30.77KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 5 contributorsNAME
MooseX::Types::LoadableClass - ClassName type constraint with coercion to load the class.
VERSION
version 0.015
SYNOPSIS
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.
DESCRIPTION
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 (or bug-MooseX-Types-LoadableClass@rt.cpan.org).
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
onirc.perl.org
.AUTHOR
Tomas Doran <bobtfish@bobtfish.net>
CONTRIBUTORS
Karen Etheridge <ether@cpan.org>
Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Florian Ragwitz <rafl@debian.org>
Gregory Oschwald <goschwald@maxmind.com>
Сергей Романов <sromanov@cpan.org>
COPYRIGHT AND LICENCE
This software is copyright (c) 2010 by Infinity Interactive, Inc.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Module Install Instructions
To install MooseX::Types::LoadableClass, copy and paste the appropriate command in to your terminal.
cpanm MooseX::Types::LoadableClass
perl -MCPAN -e shell install MooseX::Types::LoadableClass
For more information on module installation, please visit the detailed CPAN module installation guide.