[Maypole-dev] Re: [Maypole] multiple Maypole applications

From: David R. Baird (dave at riverside-cms.co.uk)
Date: Tue Aug 17 2004 - 13:07:04 BST


On 16 Aug 2004 at 23:50, Simon Cozens wrote:

> Simon Cozens:
> > Applied, thanks. (Although I'm apt to miss patches on maypole@; maypole-dev@
> > is the best place for them.)
>
> Deapplied - this patch stops you being able to set the model class before
> calling setup, which is important for things which don't use the normal
> model.

Ah. OK, this seems to work. I've verified that it allows multiple
apps to co-exist, and that it also allows you to set a different
model class before calling setup.
Note that whoever is first to call

__PACKAGE__->config->{ model } = 'My::Model::Class';

before setup will reset the default model for all later apps.

Cheers,

d.

--- /.cpan/build/Maypole-1.7/blib/lib/Maypole.pm Sat Jul 17
20:15:20 2004
+++ /usr/lib/perl5/site_perl/5.6.1/Maypole.pm Tue Aug 17 10:51:45
2004
@@ -22,7 +22,9 @@
       # Naughty.
       *{$calling_class."::handler"} = sub {
Maypole::handler($calling_class, @_) };
     }
- my $config = $calling_class->config;
+ my %inherited_config = %{ $calling_class->config };
+ my $config = \%inherited_config;
+ $calling_class->config($config);
     $config->{model} ||= "Maypole::Model::CDBI";
     $config->{model}->require;
     die "Couldn't load the model class $config->{model}: $@" if $@;

-- 
Dr. David R. Baird
Riverside Content Management Systems
dave at riverside-cms.co.uk
http://www.riverside-cms.co.uk

_______________________________________________ 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