[Catalyst] Catalyst::Model::CDBI::Sweet, Class::DBI::Loader andinheritance

Will Hawes info at whawes.co.uk
Thu May 5 17:44:38 CEST 2005


Of course, silly omission. That's it. Thanks Jose.

I would like to see this integrated into Class::DBI::Loader though. I wonder if Sebastian might comment on this when he gets some time.

Regards

Will

----- Original Message -----
From: Jose Nyimi <josenyimi at skynet.be>
To: 'Will Hawes' <info at whawes.co.uk>, catalyst at lists.rawmode.org
Sent: Thu,  5 May 2005 15:36:07 +0100
Subject: RE : [Catalyst] Catalyst::Model::CDBI::Sweet, Class::DBI::Loader andinheritance


> 
> 
> > -----Message d'origine-----
> > De : catalyst-bounces at lists.rawmode.org 
> > [mailto:catalyst-bounces at lists.rawmode.org] De la part de Will Hawes
> > Envoyé : jeudi 5 mai 2005 11:22
> > À : catalyst at lists.rawmode.org
> > Objet : Re: [Catalyst] Catalyst::Model::CDBI::Sweet, 
> > Class::DBI::Loader andinheritance
> > 
> >     for my $class ( $self->loader->classes ) {
> >         $class->autoupdate(1);
> >         $c->components->{$class} ||= bless {%$self}, $class;
> >         no strict 'refs';
> >         unshift @{ $class . "::ISA" }, 'Catalyst::Model::CDBI::Sweet';
> >         *{"$class\::new"} = sub { bless {%$self}, $class };
> 
> I think (not sure though) 'Catalyst::Model::CDBI::Sweet'
> Needs to be loaded (use/require) somewhere before unshifting ISA.
> 
> Something à la:
> 
> use UNIVERSAL::require;
> my $sweet = 'Catalyst::Model::CDBI::Sweet';
> $sweet->require;
> if ($@){
> 	die qq/Couldn't load $sweet, $@/
> }
> else {
> 	no strict 'refs';
> 	unshift @{ $class . "::ISA" }, $sweet;
> }
> 
> Hope that gives you some new ideas :)
> 
> R,
> José.
> 
> 
> 
> 




More information about the Catalyst mailing list