=pod

=head1 NAME

Package::Autoloader::Generator::Eponymous_Directory - require .pl files

=head1 SYNOPSIS

	use strict;
	use lib '.'; # allows the .pl files to be read via require()
	
	package eponymous_directory;
	
	use Package::Autoloader sub{eval shift}, sub {
		$_[0]->register_rule('Eponymous_Directory', '=', undef);
	};
	
	yn(potentially_defined('hello_worlds'));
	yn(potentially_defined('hello_world'));
	yn(defined(&hello_world));
	
	hello_world();
	
	yn(defined(&hello_world));
	exit(0);
	

=head1 DESCRIPTION

The generator can be used to keep the subroutines of a module as individual .pl files in a directory. In case your module has a huge number of subroutines, out of which only a few are typically used, keeping the subroutines in an external source might conserve time and memory.

Eponymous means the same name. This generator tries to require() files of the same name as the subroutine from the directory of the same name as the package file. Example:

	Subroutine: hello_world
	Package: The::Requesting::Package
	Package File: /opt/perl5/5.10.0/The/Requesting/Package.pm
	Result:
	require('/opt/perl5/5.10.0/The/Requesting/Package/hello_world.pl');

The generator makes a listing of the directory and uses that for rule matching. Newly added .pl files will only be seen on the next start of the program.

Because of the require(), taint checks and untainting comes in for free.

=head2 Prototypes

Prototype definitions are supported, but have to be explicitely requested. It only makes sense if defining and requesting package are the same (therefore the explicit request). Beside that, the correct prototype might not be known at compile time. However, for AUTOLOADed subroutines the prototype is not checked in Perl5, so for the moment prototypes are pretty much useless.

The prototypes reside in a file called -prototypes.pl in the eponymous directory. Example:

	require('/opt/perl5/5.10.0/The/Requesting/Package/-prototypes.pl');

The following shell commands are the rough concept how to build such a prototypes-only file.

	rm -- -prototypes.pl
	cat -- *.pl \
	| grep '^sub ' \
	| sed -e 's/ *{.*$/;/' \
	> -prototypes.pl
	echo '1;' >> -prototypes.pl

=head1 ANYTHING ELSE

Please see the documentation of the upstream package L<Package::Autoloader>.

=cut
