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

From: David R. Baird (dave at riverside-cms.co.uk)
Date: Tue Aug 17 2004 - 15:42:21 BST


On 17 Aug 2004 at 13:46, Simon Flack wrote:

> On Tue, 17 Aug 2004 13:32:21 +0100, David R. Baird wrote
> [snip]
> > the current package. Using the ref short-circuits the inheritance > > mechanism. This patch retrieves the ref, converts it to a
different
> > ref, and sends that back to Class::Data::Inheritable, which can
now
> > see the change (even though the underlying data hasn't changed)
and
> > implements its inheritance magic.
>
> That doesn't work for nested data structures:
>
> MyApp->config->{auth} = {
> user_field => 'foo',
> user_class => 'My::User',
> session_args => {
> ...
> },
> };

Yes, hence the caveat in my previous email :-) A deeper copy
mechanism would be needed. I wasn't sure if nested structures were
likely to be stored in the config, but it seems so.

> > Are your apps on the same website? When I try to run multiple
> > Maypole apps on the same virtual host, I get the config of the
last
> > app overwriting the previous ones. I don't know if that would
happen
> > if the apps were running in different virtual hosts, I haven't
tried
> > that yet.
>
> 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.

d.

-- 
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