1 package # hide from PAUSE
2 DBIx::Class::Componentised;
7 use base 'Class::C3::Componentised';
8 use Carp::Clan qw/^DBIx::Class|^Class::C3::Componentised/;
11 # this warns of subtle bugs introduced by UTF8Columns hacky handling of store_column
12 # if and only if it is placed before something overriding store_column
15 my ($target, @complist) = @_;
17 # we already did load the component
18 my $keep_checking = ! (
19 $target->isa ('DBIx::Class::UTF8Columns')
21 $target->isa ('DBIx::Class::ForceUTF8')
24 my (@target_isa, $base_store_column);
26 while ($keep_checking && @complist) {
28 @target_isa = do { no strict 'refs'; @{"$target\::ISA"} }
31 my $comp = pop @complist;
33 if ($comp->isa ('DBIx::Class::UTF8Columns') || $comp->isa ('DBIx::Class::ForceUTF8') {
37 $base_store_column ||=
38 do { require DBIx::Class::Row; DBIx::Class::Row->can ('store_column') };
42 for my $existing_comp (@target_isa) {
43 my $sc = $existing_comp->can ('store_column')
46 if ($sc ne $base_store_column) {
48 my $definer = B::svref_2object($sc)->STASH->NAME;
49 push @broken, ($definer eq $existing_comp)
51 : "$existing_comp (via $definer)"
56 carp "Incorrect loading order of $comp by $target will affect other components overriding 'store_column' ("
57 . join (', ', @broken)
58 .'). Refer to the documentation of DBIx::Class::UTF8Columns for more info'
62 unshift @target_isa, $comp;
65 $class->next::method(@_);