Search::InvertedIndex::AutoLoader - A manager for autoloading Search::InvertedIndex modules


Search-InvertedIndex documentation Contained in the Search-InvertedIndex distribution.

Index


Code Index:

NAME

Top

Search::InvertedIndex::AutoLoader - A manager for autoloading Search::InvertedIndex modules

SYNOPSIS

Top

use Search::InvertedIndex::AutoLoader;

DESCRIPTION

Top

Sets up the autoloader to load the modules in the Search::InvertedIndex system on demand.

CHANGES

Top

1.01 Added Search::InvertedIndex::DB::Mysql to the list of autoloaded modules

COPYRIGHT

Top

AUTHOR

Top

Benjamin Franz

TODO

Top

Nothing.


Search-InvertedIndex documentation Contained in the Search-InvertedIndex distribution.
package Search::InvertedIndex::AutoLoader;

# $RCSfile: AutoLoader.pm,v $ $Revision: 1.2 $ $Date: 1999/06/15 22:31:07 $ $Author: snowhare $

$VERSION = "1.01";

my $_autoloaded_functions = {};

my (@packageslist) =(
	'Search::InvertedIndex',
	'Search::InvertedIndex::DB::DB_File_SplitHash',
	'Search::InvertedIndex::DB::Mysql',
	'Search::InvertedIndex::Update',
	'Search::InvertedIndex::Query',
	'Search::InvertedIndex::Query::Leaf',
	'Search::InvertedIndex::Result',
);

my ($autoloader) =<<'EOF';
package ----packagename----;
sub AUTOLOAD {
	return if ($AUTOLOAD =~ m/::(END|DESTROY)$/o);
    if (exists $_autoloaded_functions->{$AUTOLOAD}) {
        die("Attempted to autoload function '$AUTOLOAD' more than once - does it exist?\n");
    }
    $_autoloaded_functions->{$AUTOLOAD} = 1;
    my ($packagename) = $AUTOLOAD =~ m/^(.*)::[A-Z_][A-Z0-9_]*$/ois;
    eval ("use $packagename;");
    if ($@ ne '') {
        die ("Unable to use packagename: $@\n");
    }
    goto &$AUTOLOAD;
}

EOF
my ($fullload) ='';
my ($packagename);
foreach $packagename (@packageslist) {
	my ($loader) = $autoloader;
	$loader =~ s/(----packagename----)/$packagename/;
	$fullload .= $loader;
}
eval ($fullload);
if ($@ ne '') {
   die ("Failed to initialize AUTOLOAD: $@\n");
}

1;