From: Rafael Kitover Date: Fri, 21 Jan 2011 03:33:01 +0000 (-0500) Subject: fix fully qualified component classes (RT#62624) X-Git-Tag: 0.07003~4 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=716870937ce4575f397fd50b9cf5c54d260f97cc;p=dbsrgits%2FDBIx-Class-Schema-Loader.git fix fully qualified component classes (RT#62624) --- diff --git a/Changes b/Changes index 35d3300..ca52e5c 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ Revision history for Perl extension DBIx::Class::Schema::Loader + - fix fully qualified component classes (RT#62624) - improve sybase/mssql db_schema detection - remove MooseX::NonMoose from Schema files under use_moose=1 - better _tables_list for Sybase ASE diff --git a/lib/DBIx/Class/Schema/Loader.pm b/lib/DBIx/Class/Schema/Loader.pm index f4692ec..7324be5 100644 --- a/lib/DBIx/Class/Schema/Loader.pm +++ b/lib/DBIx/Class/Schema/Loader.pm @@ -520,6 +520,8 @@ domm: Thomas Klausner spb: Stephen Bennett +Matias E. Fernandez + ... and lots of other folks. If we forgot you, please write the current maintainer or RT. diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 419b9ea..99a5dd8 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -1570,7 +1570,7 @@ sub _resolve_col_accessor_collisions { my ($self, $table, $col_info) = @_; my $base = $self->result_base_class || 'DBIx::Class::Core'; - my @components = map "DBIx::Class::$_", @{ $self->components || [] }; + my @components = map { /^\+/ ? substr($_,1) : "DBIx::Class::$_" } @{ $self->components || [] }; my $table_name = ref $table ? $$table : $table; diff --git a/t/lib/TestComponentFQN.pm b/t/lib/TestComponentFQN.pm new file mode 100644 index 0000000..772c7eb --- /dev/null +++ b/t/lib/TestComponentFQN.pm @@ -0,0 +1,5 @@ +package TestComponentFQN; + +sub testcomponent_fqn { 'TestComponentFQN works' } + +1; diff --git a/t/lib/dbixcsl_common_tests.pm b/t/lib/dbixcsl_common_tests.pm index 2813f62..f8ce130 100644 --- a/t/lib/dbixcsl_common_tests.pm +++ b/t/lib/dbixcsl_common_tests.pm @@ -15,6 +15,7 @@ use Class::Unload (); use DBIx::Class::Schema::Loader::Utils 'dumper_squashed'; use List::MoreUtils 'apply'; use DBIx::Class::Schema::Loader::Optional::Dependencies (); +use Try::Tiny; use namespace::clean; use dbixcsl_test_dir qw/$tdir/; @@ -101,7 +102,7 @@ sub run_tests { $num_rescans++ if $self->{vendor} eq 'Firebird'; plan tests => @connect_info * - (182 + $num_rescans * $column_accessor_map_tests + $extra_count + ($self->{data_type_tests}{test_count} || 0)); + (183 + $num_rescans * $column_accessor_map_tests + $extra_count + ($self->{data_type_tests}{test_count} || 0)); foreach my $info_idx (0..$#connect_info) { my $info = $connect_info[$info_idx]; @@ -207,7 +208,7 @@ sub setup_schema { additional_classes => 'TestAdditional', additional_base_classes => 'TestAdditionalBase', left_base_classes => [ qw/TestLeftBase/ ], - components => [ qw/TestComponent/ ], + components => [ qw/TestComponent +TestComponentFQN/ ], inflect_plural => { loader_test4 => 'loader_test4zes' }, inflect_singular => { fkid => 'fkid_singular' }, moniker_map => \&_monikerize, @@ -422,6 +423,9 @@ sub test_schema { 'Additional Component' ); } + is ((try { $class1->testcomponent_fqn }), 'TestComponentFQN works', + 'fully qualified component class'); + SKIP: { can_ok( $class1, 'loader_test1_classmeth' ) or skip "Pre-requisite test failed", 1;