| 1 | # $Id: $ | ||
| 2 | # | ||
| 3 | package CHI::Driver::MemcachedFast::Test; | ||
| 4 | use CHI::Driver::MemcachedFast::Util qw(require_dynamic); | ||
| 5 | use strict; | ||
| 6 | use warnings; | ||
| 7 | |||
| 8 | sub import { | ||
| 9 | my $class = shift; | ||
| 10 | $class->export_to_level( 1, undef, @_ ); | ||
| 11 | } | ||
| 12 | |||
| 13 | sub packages_to_import { | ||
| 14 | return ( | ||
| 15 | qw( | ||
| 16 | Test::Deep | ||
| 17 | Test::More | ||
| 18 | Test::Exception | ||
| 19 | CHI::Driver::Memcached::Test::Util | ||
| 20 | ) | ||
| 21 | ); | ||
| 22 | } | ||
| 23 | |||
| 24 | sub export_to_level { | ||
| 25 | my ( $class, $level, $ignore ) = @_; | ||
| 26 | |||
| 27 | foreach my $package ( $class->packages_to_import() ) { | ||
| 28 | require_dynamic($package); | ||
| 29 | my @export; | ||
| 30 | if ( $package eq 'Test::Deep' ) { | ||
| 31 | |||
| 32 | # Test::Deep exports way too much by default | ||
| 33 | @export = | ||
| 34 | qw(eq_deeply cmp_deeply cmp_set cmp_bag cmp_methods subbagof superbagof subsetof supersetof superhashof subhashof); | ||
| 35 | } | ||
| 36 | else { | ||
| 37 | |||
| 38 | # Otherwise, grab everything from @EXPORT | ||
| 39 | no strict 'refs'; | ||
| 40 | @export = @{"$package\::EXPORT"}; | ||
| 41 | } | ||
| 42 | $package->export_to_level( $level + 1, undef, @export ); | ||
| 43 | } | ||
| 44 | } | ||
| 45 | |||
| 46 | 1; |