I have a single CGI script that handles every request to the application.
The CGi parameters 'mod' and 'rm' select the module to be executed and the
method within
that module respectively.
I am interested in knowing what others think about this approach.
A skeleton of my code looks like:
#!D:/Perl/bin/perl.exe
use strict;
use CGI;
use CGI::Session qw/ -ip_match/;
# Define the modules used by the application
my $modules = { session => 'Session',
modA => 'ModA',
.... => '....',
modX => 'ModX',
};
# If the client is logged on, use the requested module, otherwise force a
logon
my $mod;
my $query = new CGI;
my $session = CGI::Session->new(undef, $query, { Directory => 'some_dir' });
if ($session->param('is_logged_on')) {
$mod = $query->param('mod');
}
else {
$mod = 'session';
$query->param('rm' => 'logon_expired') unless $query->param('rm') eq
'logon';
}
require "../modules/$modules->{$mod}.pm";
# Create and run the selected app module
# $app is an instance of a super class of CGI::Application
my $app = "$modules->{$mod}"->new(TMPL_PATH => '../Templates/',
QUERY => $query);
$app->run();
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.