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

Jose Nyimi josenyimi at skynet.be
Thu May 5 16:36:07 CEST 2005



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