[Dbix-class] Patch for inject_base
Matt S Trout
dbix-class at trout.me.uk
Sat Dec 3 03:41:20 CET 2005
On Wed, Nov 30, 2005 at 07:24:29PM -0500, Vsevolod (Simon) Ilyushchenko wrote:
> 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};
I'd be happy to commit this, but is there any chance of a test case as well,
please?
--
Matt S Trout Offering custom development, consultancy and support
Technical Director contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd. mst (at) shadowcatsystems.co.uk for more information
+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
More information about the Dbix-class
mailing list