Hello all,

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

Thank you!
Gfoo

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

Reply via email to