| 1 | package # hide from PAUSE | ||||||||||||||||||||||||||||
| 2 | DBIx::Class::Componentised; | ||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||
| 4 | 383 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 383 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 383 | ▶ | use base 'Class::C3::Componentised'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 383 | ▶ | use mro 'c3'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 383 | ▶ | use DBIx::Class::Carp '^DBIx::Class|^Class::C3::Componentised'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 383 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | # this warns of subtle bugs introduced by UTF8Columns hacky handling of store_column | ||||||||||||||||||||||||||||
| 14 | # if and only if it is placed before something overriding store_column | ||||||||||||||||||||||||||||
| 15 | 22017 | ▶ | sub inject_base { | ||||||||||||||||||||||||||
|
Subroutine
inject_base: called CC=14 SCAR=26.4
Pod
documented
| |||||||||||||||||||||||||||||
| 16 | 22017 | my $class = shift; | |||||||||||||||||||||||||||
| 17 | 22017 | my ($target, @complist) = @_; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | # we already did load the component | ||||||||||||||||||||||||||||
| 20 | 22017 | ▶ | my $keep_checking = ! ( | ||||||||||||||||||||||||||
|
Condition66%2/3
$target->isa('DBIx::Class::UTF8Columns') || $target->isa('DBIx::Class::ForceUTF8')
MC/DC50%1/2
$target->isa('DBIx::Class::UTF8Columns') || $target->isa('DBIx::Class::ForceUTF8')
$target->isa('DBIx::Class::UTF8Columns')
$target->isa('DBIx::Class::ForceUTF8')
Truth table66%2/3
A || B
A= $target->isa('DBIx::Class::UTF8Columns')B= $target->isa('DBIx::Class::ForceUTF8')
| |||||||||||||||||||||||||||||
| 21 | $target->isa ('DBIx::Class::UTF8Columns') | ||||||||||||||||||||||||||||
| 22 | || | ||||||||||||||||||||||||||||
| 23 | $target->isa ('DBIx::Class::ForceUTF8') | ||||||||||||||||||||||||||||
| 24 | ); | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 22017 | my @target_isa; | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 22017 | ▶ | while ($keep_checking && @complist) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$keep_checking and @complist
MC/DC100%2/2
$keep_checking and @complist
$keep_checking
@complist
Truth table100%3/3
A and B
A= $keep_checkingB= @complist
| |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 383 | ▶ | @target_isa = do { no strict 'refs'; @{"$target\::ISA"} } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | unless @target_isa; | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 27270 | my $comp = pop @complist; | |||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | # warn here on use of either component, as we have no access to ForceUTF8, | ||||||||||||||||||||||||||||
| 36 | # the author does not respond, and the Catalyst wiki used to recommend it | ||||||||||||||||||||||||||||
| 37 | 27270 | for (qw/DBIx::Class::UTF8Columns DBIx::Class::ForceUTF8/) { | |||||||||||||||||||||||||||
| 38 | 54535 | ▶ | if ($comp->isa ($_) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | 5 | $keep_checking = 0; # no use to check from this point on | |||||||||||||||||||||||||||
| 40 | carp_once "Use of $_ is strongly discouraged. See documentation of DBIx::Class::UTF8Columns for more info\n" | ||||||||||||||||||||||||||||
| 41 | 5 | ▶ | unless $ENV{DBIC_UTF8COLUMNS_OK}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 42 | 5 | last; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | # something unset $keep_checking - we got a unicode mangler | ||||||||||||||||||||||||||||
| 47 | 27270 | ▶ | if (! $keep_checking) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 5 | my $base_store_column = do { require DBIx::Class::Row; DBIx::Class::Row->can ('store_column') }; | |||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 5 | my @broken; | |||||||||||||||||||||||||||
| 52 | 5 | for my $existing_comp (@target_isa) { | |||||||||||||||||||||||||||
| 53 | 7 | ▶ | my $sc = $existing_comp->can ('store_column') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | or next; | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 7 | ▶ | if ($sc ne $base_store_column) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | 2 | require B; | |||||||||||||||||||||||||||
| 58 | 2 | my $definer = B::svref_2object($sc)->STASH->NAME; | |||||||||||||||||||||||||||
| 59 | 2 | ▶ | push @broken, ($definer eq $existing_comp) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | ? $existing_comp | ||||||||||||||||||||||||||||
| 61 | : "$existing_comp (via $definer)" | ||||||||||||||||||||||||||||
| 62 | ; | ||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 5 | ▶ | carp "Incorrect loading order of $comp by $target will affect other components overriding 'store_column' (" | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 67 | . join (', ', @broken) | ||||||||||||||||||||||||||||
| 68 | .'). Refer to the documentation of DBIx::Class::UTF8Columns for more info' | ||||||||||||||||||||||||||||
| 69 | if @broken; | ||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 27270 | unshift @target_isa, $comp; | |||||||||||||||||||||||||||
| 73 | } | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | 22017 | $class->next::method(@_); | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 383 | 1; | |||||||||||||||||||||||||||