From: Peter Rabbitson Date: Sun, 11 Apr 2010 17:32:18 +0000 (+0000) Subject: Warn about both UTF8Columns and ForceUTF8 when loaded improperly X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=05d90040cbd946db28ca9a5f9c808e38f68faebc;p=dbsrgits%2FDBIx-Class-Historic.git Warn about both UTF8Columns and ForceUTF8 when loaded improperly --- diff --git a/lib/DBIx/Class/Componentised.pm b/lib/DBIx/Class/Componentised.pm index a82a247..10b91e9 100644 --- a/lib/DBIx/Class/Componentised.pm +++ b/lib/DBIx/Class/Componentised.pm @@ -15,22 +15,29 @@ sub inject_base { my ($target, @complist) = @_; # we already did load the component - my $keep_checking = ! $target->isa ('DBIx::Class::UTF8Columns'); + my $keep_checking = ! ( + $target->isa ('DBIx::Class::UTF8Columns') + || + $target->isa ('DBIx::Class::ForceUTF8') + ); - my @target_isa = do { no strict 'refs'; @{"$target\::ISA"} }; - my $base_store_column; + my (@target_isa, $base_store_column); while ($keep_checking && @complist) { + @target_isa = do { no strict 'refs'; @{"$target\::ISA"} } + unless @target_isa; + my $comp = pop @complist; - if ($comp->isa ('DBIx::Class::UTF8Columns')) { + if ($comp->isa ('DBIx::Class::UTF8Columns') || $comp->isa ('DBIx::Class::ForceUTF8') { $keep_checking = 0; $base_store_column ||= do { require DBIx::Class::Row; DBIx::Class::Row->can ('store_column') }; + my @broken; for my $existing_comp (@target_isa) { my $sc = $existing_comp->can ('store_column')