package parent; use strict; our $VERSION = '0.237'; sub import { my $class = shift; my $inheritor = caller(0); if ( @_ and $_[0] eq '-norequire' ) { shift @_; } else { for ( my @filename = @_ ) { s{::|'}{/}g; require "$_.pm"; # dies if the file is not found } } { no strict 'refs'; push @{"$inheritor\::ISA"}, @_; # dies if a loop is detected }; }; 1; __END__ =encoding utf8 =head1 NAME parent - Establish an ISA relationship with base classes at compile time =head1 SYNOPSIS package Baz; use parent qw(Foo Bar); =head1 DESCRIPTION Allows you to both load one or more modules, while setting up inheritance from those modules at the same time. Mostly similar in effect to package Baz; BEGIN { require Foo; require Bar; push @ISA, qw(Foo Bar); } By default, every base class needs to live in a file of its own. If you want to have a subclass and its parent class in the same file, you can tell C<parent> not to load any modules by using the C<-norequire> switch: package Foo; sub exclaim { "I CAN HAS PERL" } package DoesNotLoadFooBar; use parent -norequire, 'Foo', 'Bar'; # will not go looking for Foo.pm or Bar.pm This is equivalent to the following code: package Foo; sub exclaim { "I CAN HAS PERL" } package DoesNotLoadFooBar; push @DoesNotLoadFooBar::ISA, 'Foo', 'Bar'; This is also helpful for the case where a package lives within a differently named file: package MyHash; use Tie::Hash; use parent -norequire, 'Tie::StdHash'; This is equivalent to the following code: package MyHash; require Tie::Hash; push @ISA, 'Tie::StdHash'; If you want to load a subclass from a file that C<require> would not consider an eligible filename (that is, it does not end in either C<.pm> or C<.pmc>), use the following code: package MySecondPlugin; require './plugins/custom.plugin'; # contains Plugin::Custom use parent -norequire, 'Plugin::Custom'; =head1 HISTORY This module was forked from L<base> to remove the cruft that had accumulated in it. =head1 CAVEATS =head1 SEE ALSO L<base> =head1 AUTHORS AND CONTRIBUTORS Rafaël Garcia-Suarez, Bart Lateur, Max Maischein, Anno Siegel, Michael Schwern =head1 MAINTAINER Max Maischein C< corion@cpan.org > Copyright (c) 2007-2017 Max Maischein C<< <corion@cpan.org> >> Based on the idea of C<base.pm>, which was introduced with Perl 5.004_04. =head1 LICENSE This module is released under the same terms as Perl itself. =cut
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Algorithm | Folder | 0755 |
|
|
App | Folder | 0755 |
|
|
Archive | Folder | 0755 |
|
|
Authen | Folder | 0755 |
|
|
B | Folder | 0755 |
|
|
CGI | Folder | 0755 |
|
|
CPAN | Folder | 0755 |
|
|
Carp | Folder | 0755 |
|
|
Class | Folder | 0755 |
|
|
Config | Folder | 0755 |
|
|
Data | Folder | 0755 |
|
|
Date | Folder | 0755 |
|
|
Devel | Folder | 0755 |
|
|
Digest | Folder | 0755 |
|
|
Encode | Folder | 0755 |
|
|
Error | Folder | 0755 |
|
|
Exporter | Folder | 0755 |
|
|
ExtUtils | Folder | 0755 |
|
|
File | Folder | 0755 |
|
|
Filter | Folder | 0755 |
|
|
Getopt | Folder | 0755 |
|
|
Git | Folder | 0755 |
|
|
HTML | Folder | 0755 |
|
|
HTTP | Folder | 0755 |
|
|
IO | Folder | 0755 |
|
|
IPC | Folder | 0755 |
|
|
JSON | Folder | 0755 |
|
|
LWP | Folder | 0755 |
|
|
Locale | Folder | 0755 |
|
|
MRO | Folder | 0755 |
|
|
Math | Folder | 0755 |
|
|
Module | Folder | 0755 |
|
|
Mozilla | Folder | 0755 |
|
|
Net | Folder | 0755 |
|
|
POD2 | Folder | 0755 |
|
|
Package | Folder | 0755 |
|
|
Params | Folder | 0755 |
|
|
Parse | Folder | 0755 |
|
|
Perl | Folder | 0755 |
|
|
PerlIO | Folder | 0755 |
|
|
Pod | Folder | 0755 |
|
|
Software | Folder | 0755 |
|
|
Sub | Folder | 0755 |
|
|
TAP | Folder | 0755 |
|
|
Term | Folder | 0755 |
|
|
Test | Folder | 0755 |
|
|
Test2 | Folder | 0755 |
|
|
Text | Folder | 0755 |
|
|
Thread | Folder | 0755 |
|
|
Time | Folder | 0755 |
|
|
Try | Folder | 0755 |
|
|
Types | Folder | 0755 |
|
|
WWW | Folder | 0755 |
|
|
XML | Folder | 0755 |
|
|
autodie | Folder | 0755 |
|
|
inc | Folder | 0755 |
|
|
lib | Folder | 0755 |
|
|
libwww | Folder | 0755 |
|
|
local | Folder | 0755 |
|
|
CGI.pm | File | 121.63 KB | 0644 |
|
CGI.pod | File | 65.66 KB | 0644 |
|
CPAN.pm | File | 138.01 KB | 0644 |
|
Carp.pm | File | 30.32 KB | 0644 |
|
Digest.pm | File | 10.46 KB | 0644 |
|
Env.pm | File | 5.39 KB | 0644 |
|
Error.pm | File | 24.29 KB | 0644 |
|
Expect.pm | File | 98.09 KB | 0644 |
|
Exporter.pm | File | 18.31 KB | 0644 |
|
Fatal.pm | File | 56.81 KB | 0644 |
|
Fh.pm | File | 166 B | 0644 |
|
Git.pm | File | 46.95 KB | 0644 |
|
LWP.pm | File | 21.17 KB | 0644 |
|
Test2.pm | File | 6.24 KB | 0644 |
|
autodie.pm | File | 12.58 KB | 0644 |
|
bigint.pm | File | 22.85 KB | 0644 |
|
bignum.pm | File | 20.64 KB | 0644 |
|
bigrat.pm | File | 15.78 KB | 0644 |
|
constant.pm | File | 14.38 KB | 0644 |
|
experimental.pm | File | 6.83 KB | 0644 |
|
newgetopt.pl | File | 2.15 KB | 0644 |
|
ok.pm | File | 967 B | 0644 |
|
parent.pm | File | 2.51 KB | 0644 |
|
perldoc.pod | File | 9.16 KB | 0644 |
|
perlfaq.pm | File | 77 B | 0644 |
|
perlfaq.pod | File | 22.22 KB | 0644 |
|
perlfaq1.pod | File | 14.12 KB | 0644 |
|
perlfaq2.pod | File | 9.24 KB | 0644 |
|
perlfaq3.pod | File | 36.66 KB | 0644 |
|
perlfaq4.pod | File | 87.3 KB | 0644 |
|
perlfaq5.pod | File | 54.21 KB | 0644 |
|
perlfaq6.pod | File | 38.69 KB | 0644 |
|
perlfaq7.pod | File | 36.93 KB | 0644 |
|
perlfaq8.pod | File | 48.93 KB | 0644 |
|
perlfaq9.pod | File | 14.5 KB | 0644 |
|
perlglossary.pod | File | 134.02 KB | 0644 |
|