| line | stmt | bran | cond | sub | pod | time | code | 
| 1 | 2 |  |  | 2 |  | 67286 | use strict qw; # no refs | 
|  | 2 |  |  |  |  | 7 |  | 
|  | 2 |  |  |  |  | 100 |  | 
| 2 | 2 |  |  | 2 |  | 16 | use warnings; | 
|  | 2 |  |  |  |  | 6 |  | 
|  | 2 |  |  |  |  | 152 |  | 
| 3 |  |  |  |  |  |  |  | 
| 4 |  |  |  |  |  |  | package Exporter::WithBase; | 
| 5 |  |  |  |  |  |  | # ABSTRACT: Like Exporter, but add a '-base' flag to declare a class as a child | 
| 6 |  |  |  |  |  |  | $Exporter::WithBase::VERSION = '1.00'; | 
| 7 | 2 |  |  | 2 |  | 16 | use Exporter 5.57 (); | 
|  | 2 |  |  |  |  | 98 |  | 
|  | 2 |  |  |  |  | 554 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | sub import | 
| 10 |  |  |  |  |  |  | { | 
| 11 | 2 |  |  | 2 |  | 24 | my $caller = caller; | 
| 12 |  |  |  |  |  |  | # If -base, inherit from Exporter | 
| 13 | 2 | 50 | 33 |  |  | 19 | if (@_ >= 2 && $_[1] eq '-base') { | 
| 14 | 0 |  |  |  |  | 0 | splice @_, 1, 1; | 
| 15 | 0 | 0 |  |  |  | 0 | push @{"${caller}::ISA"}, $_[0] eq __PACKAGE__ ? 'Exporter' : $_[0]; | 
|  | 0 |  |  |  |  | 0 |  | 
| 16 |  |  |  |  |  |  | } | 
| 17 |  |  |  |  |  |  | # Inject _import as import | 
| 18 | 2 |  |  |  |  | 8 | *{"${caller}::import"} = \&_import; | 
|  | 2 |  |  |  |  | 144 |  | 
| 19 |  |  |  |  |  |  | # No symbols to export | 
| 20 |  |  |  |  |  |  | } | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | sub _import | 
| 23 |  |  |  |  |  |  | { | 
| 24 | 3 | 100 | 66 | 3 |  | 138 | if (@_ >= 2 && $_[1] eq '-base') { | 
| 25 | 1 |  |  |  |  | 5 | splice @_, 1, 1; | 
| 26 | 1 |  |  |  |  | 4 | my $caller = caller; | 
| 27 | 1 |  |  |  |  | 3 | push @{"${caller}::ISA"}, $_[0]; | 
|  | 1 |  |  |  |  | 22 |  | 
| 28 |  |  |  |  |  |  | } | 
| 29 | 3 |  |  |  |  | 5524 | goto &Exporter::import; | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  |  | 
| 32 |  |  |  |  |  |  | 1; | 
| 33 |  |  |  |  |  |  | __END__ |