why don't you just use a PerlAuthenHandler? see chapter 6 online at
modperl.com
On Tue, 23 Nov 1999, Trevor Phillips wrote:
> I've written an Authentication Handler using the Access phase, where someone
> must validate themselves before accessing a resource. The way I've done it, if
> the client is not validated, it changes the PerlHandler to reference a "Login"
> subroutine, which produces the login page. This works fine, although currently
> the protected documents are also handled by the module (to append a footer
> relating to their session), and so the normal handler is already associated
> with "perl-script".
>
> I'm now encountering a problem where I'm trying to use the same module to
> protect simple CGI's, where I'm trying to avoid requiring any custom code
> additions to the CGI's (and would also work with binary CGI's). The problem is
> the normal content handler. Is there a way to leave the handler as the normal
> CGI handler, but in an instance where a login is required, override the handler
> and enable the perl-script handler??
>
> ie;
>
> If authenticated
> {
> handle CGI as per usual
> }
> else
> {
> replace handler with custom login screen page
> }
>
> This is the code I've currently got, which alters the handlers:
>
> $r->handler("perl-script");
> $r->set_handlers(PerlHandler=>[\&LoginScreen]);
> return OK;
>
> As far as I can see, this should both change the handler to use the Perl
> Script, AND define the perl handler as referencing a subroutine LoginScreen.
> However, in practice the CGI is being executed as per usual (ie; the CGI
> handler isn't being overridden by the mod_perl one).
>
> Any ideas?
>
> --
> . Trevor Phillips - http://jurai.murdoch.edu.au/ .
> : CWIS Technical Officer - [EMAIL PROTECTED] :
> | IT Services - Murdoch University |
> >------------------- Member of the #SAS# & #CFC# --------------------<
> | On nights such as this, evil deeds are done. And good deeds, of /
> | course. But mostly evil, on the whole. /
> \ -- (Terry Pratchett, Wyrd Sisters) /
>