> 
> I am trying to figure out a way to set a PerlAuthenHandler (using
> $r->push_handlers()) from a PerlInitHandler.

Follo-wup with more info.

here is my auth sub:

sub auth {
    my $r = shift;

    print STDERR Data::Dumper->Dump( [$r], ['Apache']);
    print STDERR "in auth handler\n"
    return OK;
}

Adding this to the handler sub:

    print STDERR "Before pushing:";
    $do->get_handlers;
    $r->push_handlers(PerlAuthenHandler => \&bgep_auth );
    print STDERR "After pushing:";
    $do->get_handlers;

give me this in the error_log:

Before pushing:
Debug get_handlers for [127.0.0.7] /test/ during PerlInitHandler
After pushing:
Debug get_handlers for [127.0.0.7] /test/ during PerlInitHandler
    CODE(0x831a06c) => enabled as PerlAuthenHandler

Apparently, pushing a code ref onto the handler stack, which is what the docs
say to do, isn't what I want. Changing the relevent section in handler to:

    print STDERR "Before pushing:";
    $do->get_handlers;
    $r->push_handlers(PerlAuthenHandler => &bgep_auth );
    print STDERR "After pushing:";
    $do->get_handlers;

Gives me:

Before pushing:
Debug get_handlers for [127.0.0.7] /test/ during PerlInitHandler
$Apache = undef;
in auth handler
After pushing:
Debug get_handlers for [127.0.0.7] /test/ during PerlInitHandler

(It runs the sub in place, and $r is not defined)

darren

-- 
There is no hell. There is only France.

Reply via email to