-=head1 NAME
-
-MooseX::Types::Combine - Combine type libraries for exporting
-
-=cut
-
package MooseX::Types::Combine;
-our $VERSION = "0.24";
+
+# ABSTRACT: Combine type libraries for exporting
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;
+ }
+
my %from;
for my $type (@types) {
unless ($types{$type}) {
@$store;
}
+sub _check_type_lib {
+ my ($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');
+}
+
sub _provided_types {
my ($class, %types) = @_;
%$types;
}
-sub _check_type_lib {
- my ($class, $lib) = @_;
-
- Class::MOP::load_class($lib);
-
- die "Cannot use $lib in a combined type library, it does not provide any types"
- unless $lib->can('type_names');
-}
-
=head1 SEE ALSO
L<MooseX::Types>
-=head1 AUTHOR
-
-See L<MooseX::Types/AUTHOR>.
-
=head1 LICENSE
This program is free software; you can redistribute it and/or modify