1 package # hide from PAUSE
2 DBIx::Class::Componentised;
10 my ($class, $target, @to_inject) = @_;
13 foreach my $to (reverse @to_inject) {
14 unshift( @{"${target}::ISA"}, $to )
15 unless ($target eq $to || $target->isa($to));
19 # Yes, this is hack. But it *does* work. Please don't submit tickets about
20 # it on the basis of the comments in Class::C3, the author was on #dbix-class
21 # while I was implementing this.
23 my $table = { Class::C3::_dump_MRO_table };
24 eval "package $target; import Class::C3;" unless exists $table->{$target};
29 my $base = $class->component_base_class;
30 my @comp = map { /^\+(.*)$/ ? $1 : "${base}::$_" } grep { $_ !~ /^#/ } @_;
31 $class->_load_components(@comp);
32 Class::C3::reinitialize();
35 sub load_own_components {
37 my @comp = map { "${class}::$_" } grep { $_ !~ /^#/ } @_;
38 $class->_load_components(@comp);
41 sub _load_components {
42 my ($class, @comp) = @_;
43 foreach my $comp (@comp) {
47 $class->inject_base($class => @comp);