use strict;
use warnings;
-use Class::MOP ();
+use Module::Runtime 'use_module';
=head1 SYNOPSIS
=head1 DESCRIPTION
-Allows you to export types from multiple type libraries.
+Allows you to export types from multiple type libraries.
-Libraries on the right side of the type libs passed to L</provide_types_from>
+Libraries on the right end of the list passed to L</provide_types_from>
take precedence over those on the left in case of conflicts.
=cut
my %types = $class->_provided_types;
- if ( grep { $_ eq ':all' } @types ){
- $_->import({ -into => $caller }, q{:all} ) for $class->provide_types_from;
- return;
+ if ( grep { $_ eq ':all' } @types ) {
+ $_->import( { -into => $caller }, q{:all} )
+ for $class->provide_types_from;
+ return;
}
my %from;
sub _check_type_lib {
my ($class, $lib) = @_;
- Class::MOP::load_class($lib);
+ use_module($lib);
die "Cannot use $lib in a combined type library, it does not provide any types"
unless $lib->can('type_names');