3 MooseX::Types::Wrapper - Wrap exports from a library
7 package MooseX::Types::Wrapper;
10 use Carp::Clan qw( ^MooseX::Types );
13 use namespace::clean -except => [qw( meta )];
15 extends 'MooseX::Types';
19 See L<MooseX::Types/SYNOPSIS> for detailed usage.
28 my ($class, @args) = @_;
29 my %libraries = @args == 1 ? (Moose => $args[0]) : @args;
31 for my $l (keys %libraries) {
33 croak qq($class expects an array reference as import spec)
34 unless ref $libraries{ $l } eq 'ARRAY';
37 = ($l eq 'Moose' ? 'MooseX::Types::Moose' : $l );
38 Class::MOP::load_class($library_class);
40 $library_class->import({
41 -into => scalar(caller),
43 }, @{ $libraries{ $l } });
54 =head1 AUTHOR AND COPYRIGHT
56 Robert 'phaylon' Sedlacek C<E<lt>rs@474.atE<gt>>, with many thanks to
57 the C<#moose> cabal on C<irc.perl.org>.
61 This program is free software; you can redistribute it and/or modify
62 it under the same terms as perl itself.