Can somebody help me out with Method Handlers in
Apache2 - mod_perl 1.99? I'm new to windows and its
threading issues.

Here's a simple authentication handler that shows where
I'm getting stuck. I need to initialize a AuthDerivedHandler
object but I'm not sure exactly how to do this.

package Apache::AuthBaseHandler;

use strict;

use Apache::Constants qw(:common);
use vars qw($VERSION);

$VERSION = '3.00';

sub authenticate ($$) {
  my ($self, $r) = @_;
  return OK;
}

sub new  {
  my $this = shift;
  my $class = ref($this) || $this;
  my $self = {};
  bless $self, $class;
  return $self;
}


1;

__END__


package Apache::AuthDerivedHandler;
use strict;
use Apache;
use Apache::Constants qw(:common);
use Apache::AuthBaseHandler;
use vars qw($VERSION @ISA);

$VERSION = "1.0";
@ISA = qw(Apache::AuthBaseHandler);


sub NonMethodAuthHandler($)  {
  my $r = shift;

  my $authhandler = Apache::AuthDerivedHandler->new();

  return $authhandler->authenticate($r);

}

1;



In my httpd.conf I have the following directives:

  <Location /modperl/crash>
       PerlOptions +GlobalRequest
       SetHandler perl-script
      AuthType Apache::AuthCookieHandler
      PerlAuthenHandler Apache::AuthDerivedHandler->authenticate
      PerlHandler Apache::hello
       require valid-user
  </Location>


  <Location /modperl/ok>
       PerlOptions +GlobalRequest
       SetHandler perl-script
      AuthType Apache::AuthCookieHandler
      PerlAuthenHandler Apache::AuthDerivedHandler->authenticate
      PerlHandler Apache::hello
      require valid-user
  </Location>


In my startup.pl in have:

$ENV{MOD_PERL} or die "not running under mod_perl!";
use Apache2 ();
use Apache::compat ();

use Carp ();
use CGI ();
CGI->compile(':all');
CGI->compile(':standard');

use CGI::Carp;
use Apache::AuthDerivedHandler;
1;






Reply via email to