I've written an access handler which takes some custom configuration
directives based on the instructions in chaper 8 of the Eagle book.
Everything makes and installs fine, and I am able to load the module
with a PerlModule directive, but when I try to use the directives
defined in my module I get an error:
"Invalid command 'WhiteListAllow', perhaps mis-spelled or defined by a
module not included in the server configuration"
Apache 1.3.11, Perl 5.00503, mod_perl 1.22.
My Makefile.PL:
-
package Emusic::WhiteList;
use ExtUtils::MakeMaker;
use Apache::ExtUtils qw(command_table);
use Apache::src;
my @directives = (
{ name = 'WhiteListAllow',
errmessg = 'a domain name to allow',
args_how = 'ITERATE',
req_override = 'OR_AUTHCFG'
},
{ name = 'WhiteListDenyURI',
errmessg = 'uri to redirect denied clients to',
args_how = 'TAKE1',
req_override = 'OR_AUTHCFG'
},
);
command_table(\@directives);
WriteMakefile(
'NAME' = __PACKAGE__,
'VERSION_FROM' = 'WhiteList.pm', # finds $VERSION
'INC' = Apache::src-new-inc, # e.g.,
'-I/usr/include/other',
'INSTALLSITEARCH' = '/usr/local/apache/lib/perl',
'INSTALLSITEARCH' = '/usr/local/apache/lib/perl',
);
__END__
The relevant portions of the module:
-
package Emusic::WhiteList;
use strict;
use vars qw($VERSION);
use Apache::Constants qw(:common REDIRECT);
use Apache::ModuleConfig ();
use DynaLoader ();
$VERSION = '1.00';
if ($ENV{MOD_PERL}) {
no strict;
@ISA = qw(DynaLoader);
__PACKAGE__-bootstrap($VERSION);
}
sub handler {
.
.
.
}
sub WhiteListAllow ($$@){
my ($cfg,$parms,$domain) = @_;
$cfg-{WhiteListAllow}{$domain}++;
}
sub WhiteListDenyURI ($$$){
my ($cfg,$parms,$uri) = @_;
$cfg-{WhiteListDenyURI}=$uri;
}
1;
__END__
-
The configuration portion is simple - I merely:
PerlRequire Emusic::WhiteList
and in a directory block:
Directory /foo/
PerlAccessHandler Emusic::WhiteList
WhiteListAllow foo.com
WhiteListDenyURI http://www.foo.com/bar/baz.html
/Directory
I'm stumped. For the most part, I copied and pasted my code directly
from the book.
Has anyone else hit this problem?
--
Kevin | "Though there are ... few restrictions on the vote nowadays ...
Murphy | some standards are still upheld ... at last report, the votes
| from the entire God-forsaken state of Texas are still thrown,
| uncounted and burning, into the River Charles." - T.H. Zweibel