[Dbix-class] Patch for inject_base
Vsevolod (Simon) Ilyushchenko
simonf at cshl.edu
Thu Dec 1 01:24:29 CET 2005
Matt,
I've found that when for some reason the same class is passed twice to
the hierarchy, Class::C3 complains. To fix this, I suggest the following
patch:
--- lib/DBIx/Class/Componentised.pm 2005-11-26 18:26:14.000000000 -0500
+++ /opt/software/perl/lib/DBIx/Class/Componentised.pm 2005-11-30
18:46:11.000000000 -0500
@@ -6,7 +6,8 @@
my ($class, $target, @to_inject) = @_;
{
no strict 'refs';
- unshift(@{"${target}::ISA"}, grep { $target ne $_ } @to_inject);
+ my %isa = map {$_=>1} @{"${target}::ISA"};
+ unshift(@{"${target}::ISA"}, grep { $target ne $_ && !$isa{$_}}
@to_inject);
}
my $table = { Class::C3::_dump_MRO_table };
eval "package $target; import Class::C3;" unless exists
$table->{$target};
Simon
--
Simon (Vsevolod ILyushchenko) simonf at cshl.edu
http://www.simonf.com
"Think like a man of action, act like a man of thought."
Henri Bergson
More information about the Dbix-class
mailing list