PerlSetVar RootNamespace CEMS::EXT
PerlFixupHandler CEMS::AutoLoader
####
package CEMS::AutoLoader;
use Apache::Constants qw(:common);
use strict;
sub handler {
my $r = shift;
return DECLINED unless $r->is_main;
#get package name
my $module = join ('::',$r->dir_config('RootNamespace'),
split (/\//, substr($r->uri(),1,-3) ) );
#see if package really exists and set content handler
if (eval "require ".$module) {
$r->push_handlers(PerlHandler => $module);
$r->handler('perl-script');
return OK;
}
#require threw an exception so package does not exist
return DECLINED if ($@);
}
1;