1 package # hide from PAUSE
2 DBIx::Class::Componentised;
7 use base 'Class::C3::Componentised';
10 use DBIx::Class::Carp '^DBIx::Class|^Class::C3::Componentised';
12 # this warns of subtle bugs introduced by UTF8Columns hacky handling of store_column
13 # if and only if it is placed before something overriding store_column
16 my ($target, @complist) = @_;
18 # we already did load the component
19 my $keep_checking = ! (
20 $target->isa ('DBIx::Class::UTF8Columns')
22 $target->isa ('DBIx::Class::ForceUTF8')
27 while ($keep_checking && @complist) {
29 @target_isa = do { no strict 'refs'; @{"$target\::ISA"} }
32 my $comp = pop @complist;
34 # warn here on use of either component, as we have no access to ForceUTF8,
35 # the author does not respond, and the Catalyst wiki used to recommend it
36 for (qw/DBIx::Class::UTF8Columns DBIx::Class::ForceUTF8/) {
37 if ($comp->isa ($_) ) {
38 $keep_checking = 0; # no use to check from this point on
39 carp_once "Use of $_ is strongly discouraged. See documentation of DBIx::Class::UTF8Columns for more info\n"
40 unless $ENV{DBIC_UTF8COLUMNS_OK};
45 # something unset $keep_checking - we got a unicode mangler
46 if (! $keep_checking) {
48 my $base_store_column = do { require DBIx::Class::Row; DBIx::Class::Row->can ('store_column') };
51 for my $existing_comp (@target_isa) {
52 my $sc = $existing_comp->can ('store_column')
55 if ($sc ne $base_store_column) {
57 my $definer = B::svref_2object($sc)->STASH->NAME;
58 push @broken, ($definer eq $existing_comp)
60 : "$existing_comp (via $definer)"
65 carp "Incorrect loading order of $comp by $target will affect other components overriding 'store_column' ("
66 . join (', ', @broken)
67 .'). Refer to the documentation of DBIx::Class::UTF8Columns for more info'
71 unshift @target_isa, $comp;
74 $class->next::method(@_);