Hi!
I'm trying to build an application with several required run modes,
but allow site-specific configuration of additional run modes,
each with their own template files. This works just fine, if none
of these run modes require anything 'unusual'. By that I am
referring specifically to template variables not known by the
application. Additional variables might come from site-supplied
code, or configuration information pulled from a backend datastore
or configuration file. Some rough pseudocode:
During cgiapp_init():
Load template files, and add a param with the template name
and object as the key/value pair, including site-supplied ones.
During setup():
$self->run_modes( 'reqRM1' => 'reqMeth1', 'reqRM2' => 'reqMeth2');
foreach site-supplied template {
$self->run_modes( rmName, (supplied rmMeth || generic) );
}
$self->run_modes( ...other required run mode(s) );
The generic() method is straightforward:
. Retrieve the current run mode
. Retrieve the param value for that runmode template, i.e. the
template object
. Set a common set of template params and output
The problem comes in when I want to invoke a site-specific
method in a site-specific module (this seems like the easiest
way to have the application extended, rather than mucking with
the application code). If the the module name is in $tMod, I can
load the module with:
$tMod =~ s/::/\//g;
$tMod .= '.pm';
require $tMod;
$tMod->import();
Assuming the module exports its method, this would work,
but alas, it needs access to the cgiapp params. How can
I get around this?? I thought about making it a derived class
(and dropping all the exporter stuff!) and calling new(), but I'm
really unsure about that. Is this a nut someone has already
cracked?? Many, many thanks in advance for *any* clues!!!
-r
---------------------------------------------------------------------
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.