Isn't the first object passed the class it self if you use method-style.
The error message seems to say this ;-)

sub handler {
   my $self = shift;
   my $r    = shift;
...
}

Tom

John Russell wrote:
> Hi,
> 
> I'm trying to migrate from MP1 to MP2 and having trouble with
> 
> get_basic_auth_pw and note_basic_auth_failure
> 
> which  can not be found ..
> 
>   <Location /db>
>     ...
>     AuthName Database
>     AuthType Basic
>     PerlAuthenHandler Xdb::AuthOra2->handler
>     require valid-user
>     PerlResponseHandler Xdb::ApacheDB->handler
>     SetHandler perl-script
> </Location>
> 
> 
> package Xdb::AuthOra2;
> 
> use strict;
> 
> use Apache2::Access ();
> #use Apache2::RequestUtil ();
> use Apache2::Const -compile => qw (OK DECLINED REDIRECT
> HTTP_UNAUTHORIZED);
> use Apache2::ServerUtil ();
> #use APR::URI ();
> #use Apache2::RequestRec();
> 
> sub handler {
>    my $q = shift;
> 
>    # get_basic_auth_pw not being found, temporarily comment out
>    #my ($status, $sent_pw) = $q->get_basic_auth_pw();
>    #return $status unless $status == Apache2::Const::OK;
> 
>    my $sent_pw = 'scott';
>    my $user    = 'tiger';
> 
>    #my $user  = $q->user();
> 
>    unless ($user and $sent_pw) {
>       $q->note_basic_auth_failure;
>       #$q->log_reason("Both a username and password must be provided",
>       #               $q->filename);
>       return Apache2::Const::HTTP_UNAUTHORIZED;
>    }
> 
>    my $reason = authenticate($q, $user, $sent_pw);
> 
>    if ($reason) {
>       $q->note_basic_auth_failure;
>       #$q->log_reason($reason, $q->filename);
>       return Apache2::Const::HTTP_UNAUTHORIZED;
>    }
>    return Apache2::Const::OK;
> }
> 
> sub authenticate {
> 
>    my $r        = shift;
>    my $username = shift;
>    my $password = shift;
> 
>    my $authok;
> 
>    ...
> 
>    if ($authok != 1) {
>      return "Your request was not authorized.\n";
>    }
> 
> }
> 
> 
> 1;
> __END__
> 
> 
> this fails at run time with
> 
> Can't locate object method "note_basic_auth_failure" via package
> "Xdb::AuthOra2" at /home/httpd/ph/Xdb/AuthOra2.pm line 34.
> 
> The module appears to be present
> 
> # find /usr/lib/perl5 -name Access.pm
> /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/Apache2/Access.pm
> 
> # ls /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi/auto/
> Apache2/Access
> Access.bs  Access.so
> 
> Any suggestions why the Apache2::Access functions are unavailable
> would be most helpful, TIA.
> 
> John.
> 
> 
> 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to