Re: Request methods not found
[prev]
[thread]
[next]
[Date index for 2004/11/02]
Hi Marina,
Can you post a bit of your http.conf which declares
your AuthHandler's usage?
Are you saying:-
PerlAuthHandler Our::Auth->authen_handler
or
PerlAuthHandler Our::Authen::authenhandler
I ran some code across SuSe and Redhat and noticed
different behviours for using "->".
If you use "->" I think that this is interpreted as a
'method handler' and as such the first argument to
your authen_handler subroutine would be your classname
(Our::Auth) and the second argument would be the $r
(Apache->request).
Can you add this to your code:-
> package Our::Auth;
> use strict;
> use Apache;
> use Apache::Constants qw(:common);
>
use Data::Dumper;
> use mod_perl ();
>
> sub authen_handler {
>
print STDERR Dumper(@_); #lets see what you
got passed
> my $r = shift;
>
> my ($res, $sent_pw) = $r->get_basic_auth_pw;
>
> return $res if $res != OK;
>
> my $user = $r->connection->user;
> if (!$user || !$sent_pw) {
> return AUTH_REQUIRED;
> }
> return OK;
> }
> 1;
I suspect that you will see 2 variables passed into
you subroutine
1 = 'Our::Auth'
2 = instantiated Apache object
However I did have a skinful last night and my brain
is a little sluggish, so I could be wrong...(anybody
feel free to correct me)
Marty
--- Marina Markus <mary@xxxxxxx.xxx.xx.xx> wrote:
>
> Hello Geoffrey,
>
> Thank you for your answer; but I have to ask you for
> more help
> as I neither use a pre-build version nor work with
> subclassing.
> The handler code is very simple:
>
> package Our::Auth;
> use strict;
> use Apache;
> use Apache::Constants qw(:common);
>
> use mod_perl ();
>
> sub authen_handler {
>
> my $r = shift;
>
> my ($res, $sent_pw) = $r->get_basic_auth_pw;
>
> return $res if $res != OK;
>
> my $user = $r->connection->user;
> if (!$user || !$sent_pw) {
> return AUTH_REQUIRED;
> }
> return OK;
> }
> 1;
>
> This code works OK in RedHat but cannot find
> "get_basic_auth_pw" in SGI.
> Still, my feeling is that that something simple but
> imporant is omitted
> in the code.
>
> > that's right. are you rolling your own on SGI or
> using a pre-compiled
> > package? if the package is pre-compliled you
> might want to make sure that
> > it's mod_perl 1.2X and not mod_perl 1.99_XX, which
> is the precursor to
> > mod_perl 2.0 and a completely different beast.
>
> I didn't use pre-compiled package but built it from
> source (Apache 1.3.31+
> PHP 4.3.8 + mod_perl 1.29).
>
> Maybe the following can be important: compilation is
> 32-bit
> (with "-o32" flag), otherwise Apache build complains
> of incompatible
> libraries. In fact, I had to configure mod_perl
> using a Shell-script:
>
> #!/bin/sh
> CC="cc -o32" \
> perl Makefile.PL PERL_LOG=1 PERL_CHILD_INIT=1 \
> PERL_AUTHEN=1 PERL_ACCESS=1 PERL_AUTHZ=1 \
> PERL_CLEANUP=1 PERL_STACKED_HANDLERS=1 \
> USE_APACI=1 APACI_ARGS='--with-layout=Apache
> --prefix=/apache
> --activate-module=src/modules/php4/libphp4.a'
>
> Still, there were no error messages concerning
> 32-to-64 incompatibility,
> so it may be not relevant.
>
> > well, that message says that it can't find
> get_basic_auth_pw() via
> > Our::Auth. it should be looking for it via the
> Apache class, not
> > Our::Auth.
>
> What checks can I do to see if Apache class is seen
> by mod_perl?
>
> Thank you,
>
> Marina Markus
> mary@xxxxxxx.xxx.xx.xx
>
>
> On Mon, 1 Nov 2004, Geoffrey Young wrote:
>
> >
> >
> > Marina Markus wrote:
> > > Hello,
> > >
> > > With Geoffrey Young's generous help I have
> successfully implemented
> > > authentication using my own handler subroutine
> defined as PerlAuthenHandler.
> >
> > :)
> >
> >
> > > This works OK in RedHat but not on SGI (IRIX
> 6.2). Call to the handler fails
> > > complaining that it cannot find request object
> methods, be it "connection"
> > > or "get_basic_auth_pw", saying, for example:
> > >
> > > [Mon Nov 1 12:54:13 2004] [error] Can't locate
> object method
> > > "get_basic_auth_pw" via package "Our::Auth" at
> > > /usr/local/lib/perl5/site_perl/5.005/Our/Auth.pm
> line 16, <DATA> chunk
> > > 225.\n
> >
> > well, that message says that it can't find
> get_basic_auth_pw() via
> > Our::Auth. it should be looking for it via the
> Apache class, not Our::Auth.
> > if you're looking for it via $r blessed into
> Our::Auth you need to make
> > sure that you're doing subclassing properly for
> mod_perl (which is a bit
> > different than normal perl subclasses). see
> >
> >
>
http://www.modperlcookbook.org/code/ch10/Cookbook/Apache.pm
> >
> > for an example.
> >
> > if you're not trying any subclassing tricks then
> something is definitely
> > amuck - $r should be an 'Apache' object (or
> 'Apache::RequestRec' in mp2)
> > when you call $r->note_basio_auth_pw.
> >
> > >
> > > These methods should come with the installation
> of mod_perl, shouldn't they?
> >
> > yes.
> >
> > > A bare installation of Apache 1.3.31+mod_perl
> 1.29 on a RedHat works OK
> > > without demanding any addition Perl modules to
> be installed.
> >
> > that's right. are you rolling your own on SGI or
> using a pre-compiled
> > package? if the package is pre-compliled you
> might want to make sure that
> > it's mod_perl 1.2X and not mod_perl 1.99_XX, which
> is the precursor to
> > mod_perl 2.0 and a completely different beast.
> >
> > >
> > > Maybe the ancient Perl version (5.005) is to
> blame?
> >
> > nope.
> >
> > as I said, based on the message above something is
> amuck that looks to have
> > nothing to do with mod_perl, but rather the way
> that get_basic_auth_pw() is
> > being invoked.
> >
> > HTH
> >
> > --Geoff
> >
> > --
> > Report problems: http://perl.apache.org/bugs/
> > Mail list info:
> http://perl.apache.org/maillist/modperl.html
> > List etiquette:
> http://perl.apache.org/maillist/email-etiquette.html
> >
> >
>
>
> --
> Report problems: http://perl.apache.org/bugs/
> Mail list info:
> http://perl.apache.org/maillist/modperl.html
> List etiquette:
> http://perl.apache.org/maillist/email-etiquette.html
>
>
___________________________________________________________ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com
--
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html