Query: moosex::types::loadableclass
OS: debian
Section: 3pm
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
MooseX::Types::LoadableClass(3pm) User Contributed Perl Documentation MooseX::Types::LoadableClass(3pm)NAMEMooseX::Types::LoadableClass - ClassName type constraint with coercion to load the class.SYNOPSISpackage MyClass; use Moose; use MooseX::Types::LoadableClass qw/ LoadableClass /; has foobar_class => ( is => 'ro', required => 1, isa => LoadableClass, coerce => 1, ); MyClass->new(foobar_class => 'FooBar'); # FooBar.pm is loaded or an # exception is thrown.DESCRIPTIONuse Moose::Util::TypeConstraints; my $tc = subtype as ClassName; coerce $tc, from Str, via { Class::MOP::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 EXPORTEDLoadableClass A normal class / package. LoadableRole Like "LoadableClass", except the loaded package must be a Moose::Role.AUTHORSTomas Doran (t0m) "<bobtfish@bobtfish.net>" Florian Ragwitz (rafl) "<rafl@debian.org>"COPYRIGHT AND LICENSECopyright (c) 2010 the above named authors. Licensed under the same terms as perl itself. perl v5.14.2 2012-03-13 MooseX::Types::LoadableClass(3pm)
Similar Topics in the Unix Linux Community |
---|
Installing Dash Shell on OS X Lion |
Is UNIX an open source OS ? |
Introduction |
Weird 'find' results |
New UNIX and Linux History Sections |