> hey all,
> 
> I am a mod_perl newbie and have done some reading in the Eagle book.  I
> installed my first handler today(i.e. a PerlAccessHandler), but it does
> not seem to work(boy, that sounds flaky).  I am unsure after extensive
> reading if the PerlAccessHandler "must" appear in .htaccess or can it
> appear in perl.conf?  Here are the specifics:
> 
> my perl.conf file
> -----------------------
> 
> PerlRequire             conf/startup.pl
> PerlFreshRestart     On
> PerlSetEnv              MOD_PERL_TRACE all
> 
> #Location Handlers
> <Location>
>         PerlAccessHandler       Apache::GateKeeper
> </Location>
> 
> my startup.pl file
> ------------------------
> 
> #!/usr/local/bin/perl
> 
> use strict;
> use lib qw( /home/dvlp/jcrotty/apache/lib/perl );
> 
> $ENV{MOD_PERL} or die "Not running under mod_perl!";
> 
> use Carp ();
> $SIG{__WARN__} = \&Carp::cluck;
> 
> use Apache::Constants();
> use Apache::GateKeeper();
> 
> 
> and the Apache::GateKeeper script located in
> /home/dvlp/jcrotty/apache/lib/perl/Apache
> --------------------------------------------------------------------------
> -----------------------------------------------------
> package Apache::GateKeeper;
> 
> use strict;
> use Apache::Constants qw(:common);
> use ML_Cookie;
> 
> use constant SESSION_COOKIE_NAME => 'SESSION_ID';
> 
> sub handler {
>         my $r = shift;
> 
>         my($ml_cookie) = ML_Cookie->new();
>         my($cookie) =
> $ml_cookie->retrieve_cookie_value(SESSION_COOKIE_NAME);
> 
>         if ($cookie) {
>                 open(FILE, ">/tmp/dog");
>                         print FILE 'OK';
>                 close(FILE);
> 
>                 return OK;
>         }
>         else {
>                 #open(FILE,
> ">/home/dvlp/jcrotty/apache/lib/perlApache/dog");
>                 open(FILE, ">/tmp/dog");
>                         print FILE 'FORBIDDEN';
>                 close(FILE);
> 
>                 return FORBIDDEN;
>         }
> }
> 
> 
> 1;
> 
> 
> Note:  When you run something like /cgi-bin/printenv from the browser the
> /tmp/dog file never gets created from Apache::GateKeeper.
> 
> 
> Thanks for any ideas in advance,
> 
> Joe Crotty
> 
> 

Reply via email to