On Tue, 17 Aug 2004 15:42:21 +0100, David R. Baird wrote
> On 17 Aug 2004 at 13:46, Simon Flack wrote:
[snip]
> > Are you trying to use a single controller for multiple apps?
>
> My Maypole drivers inherit from a generic driver, which passes on the
> application-specific class name in the call to setup:
>
> package ISellIt;
> use base 'Generic::MaypoleDriver';
> __PACKAGE__->setup_driver;
> 1;
>
> package Generic::MaypoleDriver;
> use base 'MasonX::Maypole'; # inherits from Maypole
>
> sub setup_driver {
> my ($class) = @_;
>
> # application config object
> my $cfg = get_cfg();
>
> my $dsn = $cfg->dsn;
>
> $class->setup( $dsn, $user, $pass );
>
> $class->config->{ application_name } = $cfg->AppName;
> $class->config->{ uri_base } = $cfg->UriBase;
> $class->config->{ rows_per_page } = $cfg->RowsPerPage;
> $class->config->{ view } = 'Maypole::View::Base';
> }
>
> Is this what you mean by a single controller? Do you see any
> problems with this setup? Specifically, the $calling_class in
> Maypole::setup will be the application namespace (ISellIt) which
> should work as advertised with Class::Data::Inheritable.
I see. Each new application is modifying the base class's config(). I think
you just need to call '$class->config({})' in
Generic::MaypoleDriver->driver_setup() before modifying the config, to make
sure that it is not inheriting the 'config' from Maypole.pm.
Of course, I might be missing somethign more fundamental.
SF
_______________________________________________
maypole-dev mailing list
maypole-dev at lists.netthink.co.uk
http://lists.netthink.co.uk/listinfo/maypole-dev
This archive was generated by hypermail 2.1.3 : Thu Feb 24 2005 - 22:25:56 GMT