1 package MooseX::Types::Wrapper;
3 #ABSTRACT: Wrap exports from a library
7 use Carp::Clan qw( ^MooseX::Types );
8 use Module::Runtime 'use_module';
10 use namespace::autoclean;
12 extends 'MooseX::Types';
16 See L<MooseX::Types/SYNOPSIS> for detailed usage.
25 my ($class, @args) = @_;
26 my %libraries = @args == 1 ? (Moose => $args[0]) : @args;
28 for my $l (keys %libraries) {
30 croak qq($class expects an array reference as import spec)
31 unless ref $libraries{ $l } eq 'ARRAY';
34 = ($l eq 'Moose' ? 'MooseX::Types::Moose' : $l );
35 use_module($library_class);
37 $library_class->import({
38 -into => scalar(caller),
40 }, @{ $libraries{ $l } });
53 This program is free software; you can redistribute it and/or modify
54 it under the same terms as perl itself.