| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Namespace::Pollute; | 
| 2 |  |  |  |  |  |  | { | 
| 3 |  |  |  |  |  |  | $Namespace::Pollute::VERSION = '0.002'; | 
| 4 |  |  |  |  |  |  | } | 
| 5 |  |  |  |  |  |  | # ABSTRACT: Loads and imports the default exported symbols of a list of modules | 
| 6 |  |  |  |  |  |  |  | 
| 7 | 1 |  |  | 1 |  | 25188 | use Exporter; | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 301 |  | 
| 8 |  |  |  |  |  |  | @ISA = qw(Exporter); | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | sub import { | 
| 11 |  |  |  |  |  |  |  | 
| 12 | 1 |  |  | 1 |  | 12 | shift;    #-- The first one is our own class name | 
| 13 |  |  |  |  |  |  |  | 
| 14 | 1 | 50 |  |  |  | 6 | if ( $_[0] eq '-verbose' ) { | 
| 15 | 1 |  |  |  |  | 1 | $VERBOSE = 1; | 
| 16 | 1 |  |  |  |  | 2 | shift; | 
| 17 |  |  |  |  |  |  | } | 
| 18 |  |  |  |  |  |  |  | 
| 19 | 1 |  |  |  |  | 3 | foreach my $module (@_) { | 
| 20 | 2 |  |  |  |  | 120 | eval "require $module"; | 
| 21 |  |  |  |  |  |  |  | 
| 22 | 2 | 100 |  |  |  | 7 | if ( eval { $module->isa('Exporter') } ) { | 
|  | 2 | 50 |  |  |  | 34 |  | 
| 23 | 1 | 50 |  |  |  | 41 | print "ISA Exporter: $module\n" if $VERBOSE; | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 1 |  |  |  |  | 3 | @EXPORT = @{"${module}::EXPORT"}; | 
|  | 1 |  |  |  |  | 12 |  | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 1 |  |  |  |  | 65 | $module->import(@EXPORT); | 
| 28 |  |  |  |  |  |  |  | 
| 29 | 1 |  |  |  |  | 2 | foreach my $symbol (@EXPORT) { | 
| 30 | 3 | 50 |  |  |  | 23 | print "\tExporting: $module::$symbol\n" if $VERBOSE; | 
| 31 | 3 |  |  |  |  | 1504 | Namespace::Pollute->export_to_level( 1,, ($symbol) ); | 
| 32 |  |  |  |  |  |  | } | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | } elsif ( | 
| 35 |  |  |  |  |  |  | eval { | 
| 36 | 1 |  |  |  |  | 13 | $module->can('import'); | 
| 37 |  |  |  |  |  |  | } | 
| 38 |  |  |  |  |  |  | ) | 
| 39 |  |  |  |  |  |  | { | 
| 40 | 0 | 0 |  |  |  |  | print "Calling $module->import\n" if $VERBOSE; | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | #-- Things that have an import sub: | 
| 43 | 0 |  |  |  |  |  | $module->import; | 
| 44 |  |  |  |  |  |  | } | 
| 45 |  |  |  |  |  |  | } | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | } | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | 1; | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | __END__ |