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