9     my $inheritor = caller(0);
 
  11     if ( @_ and $_[0] eq '-norequire' ) {
 
  14         for ( my @filename = @_ ) {
 
  15             if ( $_ eq $inheritor ) {
 
  16                 warn "Class '$inheritor' tried to inherit from itself\n";
 
  20             require "$_.pm"; # dies if the file is not found
 
  26         # This is more efficient than push for the new MRO
 
  27         # at least until the new MRO is fixed
 
  28         @{"$inheritor\::ISA"} = (@{"$inheritor\::ISA"} , @_);
 
  32 "All your base are belong to us"
 
  38 parent - Establish an ISA relationship with base classes at compile time
 
  43     use parent qw(Foo Bar);
 
  47 Allows you to both load one or more modules, while setting up inheritance from
 
  48 those modules at the same time.  Mostly similar in effect to
 
  54         push @ISA, qw(Foo Bar);
 
  57 By default, every base class needs to live in a file of its own.
 
  58 If you want to have a subclass and its parent class in the same file, you
 
  59 can tell C<parent> not to load any modules by using the C<-norequire> switch:
 
  62   sub exclaim { "I CAN HAS PERL" }
 
  64   package DoesNotLoadFooBar;
 
  65   use parent -norequire, 'Foo', 'Bar';
 
  66   # will not go looking for Foo.pm or Bar.pm
 
  68 This is equivalent to the following code:
 
  71   sub exclaim { "I CAN HAS PERL" }
 
  73   package DoesNotLoadFooBar;
 
  74   push @DoesNotLoadFooBar::ISA, 'Foo';
 
  76 This is also helpful for the case where a package lives within
 
  77 a differently named file:
 
  81   use parent -norequire, 'Tie::StdHash';
 
  83 This is equivalent to the following code:
 
  87   push @ISA, 'Tie::StdHash';
 
  89 If you want to load a subclass from a file that C<require> would
 
  90 not consider an eligible filename (that is, it does not end in
 
  91 either C<.pm> or C<.pmc>), use the following code:
 
  93   package MySecondPlugin;
 
  94   require './plugins/custom.plugin'; # contains Plugin::Custom
 
  95   use parent -norequire, 'Plugin::Custom';
 
 101 =item Class 'Foo' tried to inherit from itself
 
 103 Attempting to inherit from yourself generates a warning.
 
 112 This module was forked from L<base> to remove the cruft
 
 113 that had accumulated in it.
 
 121 =head1 AUTHORS AND CONTRIBUTORS
 
 123 RafaĆ«l Garcia-Suarez, Bart Lateur, Max Maischein, Anno Siegel, Michael Schwern
 
 127 Max Maischein C< corion@cpan.org >
 
 129 Copyright (c) 2007 Max Maischein C<< <corion@cpan.org> >>
 
 130 Based on the idea of C<base.pm>, which was introduced with Perl 5.004_04.
 
 134 This module is released under the same terms as Perl itself.