From: Kent Fredric Date: Wed, 24 Aug 2011 07:53:00 +0000 (+1200) Subject: Add support for :all on MooseX::Types::Combine X-Git-Tag: v0.31~2^2~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMooseX-Types.git;a=commitdiff_plain;h=be4acfcc5d2506856b9ccb9ed6df4f5e1fb49a49 Add support for :all on MooseX::Types::Combine add a basic test for :all --- diff --git a/Changes b/Changes index 4c17e44..3590531 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ Revision history for MooseX-Types {{$NEXT}} + - Add support for qw( :all ) on MooseX::Types::Combine libraries. (kentnl) 0.29 2011-08-20 - Require namespace::clean 0.19. Tests fail with 0.18. Reported by diff --git a/lib/MooseX/Types/Combine.pm b/lib/MooseX/Types/Combine.pm index 73e1e20..010f15a 100644 --- a/lib/MooseX/Types/Combine.pm +++ b/lib/MooseX/Types/Combine.pm @@ -33,6 +33,11 @@ sub import { 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}) { diff --git a/t/18_combined_libs.t b/t/18_combined_libs.t index 6ef2191..976d924 100644 --- a/t/18_combined_libs.t +++ b/t/18_combined_libs.t @@ -36,4 +36,6 @@ qr/\Qmain asked for a type (NonExistentType) which is not found in any of the ty 'cannot combine types from a package which does not exist'; } +is exception { 'Combined'->import(':all') }, undef, ':all syntax works'; + done_testing();