| 1 | package parent; | ||
| 2 | use strict; | ||
| 3 | use vars qw($VERSION); | ||
| 4 | $VERSION = '0.236'; | ||
| 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 | s{::|'}{/}g; | ||
| 16 | require "$_.pm"; # dies if the file is not found | ||
| 17 | } | ||
| 18 | } | ||
| 19 | |||
| 20 | { | ||
| 21 | no strict 'refs'; | ||
| 22 | push @{"$inheritor\::ISA"}, @_; # dies if a loop is detected | ||
| 23 | }; | ||
| 24 | }; | ||
| 25 | |||
| 26 | 1; | ||
| 27 | |||
| 28 | __END__ |