| 1 | package parent; | ||
| 2 | use strict; | ||
| 3 | |||
| 4 | our $VERSION = '0.244'; | ||
| 5 | |||
| 6 | sub import { | ||
| 7 | my $class = shift; | ||
| 8 | |||
| 9 | my $inheritor = caller(0); | ||
| 10 | |||
| 11 | if ( @_ and $_[0] eq '-norequire' ) { | ||
| 12 | shift @_; | ||
| 13 | } else { | ||
| 14 | for ( my @filename = @_ ) { | ||
| 15 | local @_; # protect us against the loaded module changing @_ | ||
| 16 | s{::|'}{/}g; | ||
| 17 | require "$_.pm"; # dies if the file is not found | ||
| 18 | } | ||
| 19 | } | ||
| 20 | |||
| 21 | { | ||
| 22 | no strict 'refs'; | ||
| 23 | push @{"$inheritor\::ISA"}, @_; # dies if a loop is detected | ||
| 24 | }; | ||
| 25 | }; | ||
| 26 | |||
| 27 | 1; | ||
| 28 | |||
| 29 | __END__ |