On 28 Aug 2002 at 11:57, Gfoo opined:

G:I'm creating a web appication in Perl (and CGI).
G:I' ve written code that is used to create and read sessions (by using 
G:cookies or GET http method) which are used after authenticating user logins 
G:in a database. 
G:The code for handing transitions and state is about 60 lines of code. I 
G:already have made it modular, but I'm still searching for an elegant way to 
G:use this code on every script.
G:I have several pages (.pl scripts) that must be viewable only by logged in 
G:users. 
G:Do I need to put the same code on every page (and have the 'actual' script 
G:code in an if branch of the authentication code)?
G:I also have thought that I can create something like a dispatcher, which 
G:checks if the user is authenticated and then call the actual .pl script (or 
G:modules subroutines) from there.
G:How can someone avoid code repetition on all scripts that require 
G:authentication? Can I avoid having a big "if ..." statement to handle all 
G:cases? It would be nice, if only 1 to 5 lines of code were required on each 
G:script. Is there any suggested way of handling this situation?

can you use mod_perl?

intercepting the authentication step with mod_perl is very easy and will 
accomplish exactly what you want to do.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to