From: Rafael Kitover Date: Sun, 29 Nov 2009 01:56:06 +0000 (+0000) Subject: minor changes X-Git-Tag: 0.04999_13~23^2~12 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fb3bb5958c3dae19c8304c9e489713b956c93efb;p=dbsrgits%2FDBIx-Class-Schema-Loader.git minor changes --- diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 51bf652..3e93db4 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -343,6 +343,8 @@ sub _check_back_compat { unshift @{"${class}::ISA"}, 'DBIx::Class::Schema::Loader::Compat::v0_040'; Class::C3::reinitialize; +# just in case, though no one is likely to dump a dynamic schema + $self->version_to_dump('0.04006'); return; } @@ -388,14 +390,26 @@ sub _find_file_in_inc { return; } -sub _load_external { +sub _class_path { my ($self, $class) = @_; my $class_path = $class; $class_path =~ s{::}{/}g; $class_path .= '.pm'; - my $real_inc_path = $self->_find_file_in_inc($class_path); + return $class_path; +} + +sub _find_class_in_inc { + my ($self, $class) = @_; + + return $self->_find_file_in_inc($self->_class_path($class)); +} + +sub _load_external { + my ($self, $class) = @_; + + my $real_inc_path = $self->_find_class_in_inc($class); return if !$real_inc_path; @@ -403,9 +417,6 @@ sub _load_external { warn qq/# Loaded external class definition for '$class'\n/ if $self->debug; - croak 'Failed to locate actual external module file for ' - . "'$class'" - if !$real_inc_path; open(my $fh, '<', $real_inc_path) or croak "Failed to open '$real_inc_path' for reading: $!"; $self->_ext_stmt($class, diff --git a/t/backcompat/0.04006/10sqlite_common.t b/t/backcompat/0.04006/10sqlite_common.t index 4dd6adc..ea98d92 100644 --- a/t/backcompat/0.04006/10sqlite_common.t +++ b/t/backcompat/0.04006/10sqlite_common.t @@ -2,7 +2,7 @@ use strict; use lib qw(t/backcompat/0.04006/lib); use dbixcsl_common_tests; use Test::More; -plan skip_all => 'Backcompat tests disabled' +plan skip_all => 'set SCHEMA_LOADER_TESTS_BACKCOMPAT to enable these tests' unless $ENV{SCHEMA_LOADER_TESTS_BACKCOMPAT}; eval { require DBD::SQLite }; diff --git a/t/backcompat/0.04006/11mysql_common.t b/t/backcompat/0.04006/11mysql_common.t index fdb63d2..c0ef367 100644 --- a/t/backcompat/0.04006/11mysql_common.t +++ b/t/backcompat/0.04006/11mysql_common.t @@ -2,7 +2,7 @@ use strict; use lib qw(t/backcompat/0.04006/lib); use dbixcsl_common_tests; use Test::More; -plan skip_all => 'Backcompat tests disabled' +plan skip_all => 'set SCHEMA_LOADER_TESTS_BACKCOMPAT to enable these tests' unless $ENV{SCHEMA_LOADER_TESTS_BACKCOMPAT}; diff --git a/t/backcompat/0.04006/12pg_common.t b/t/backcompat/0.04006/12pg_common.t index e0b8d09..ec3e991 100644 --- a/t/backcompat/0.04006/12pg_common.t +++ b/t/backcompat/0.04006/12pg_common.t @@ -2,7 +2,7 @@ use strict; use lib qw(t/backcompat/0.04006/lib); use dbixcsl_common_tests; use Test::More; -plan skip_all => 'Backcompat tests disabled' +plan skip_all => 'set SCHEMA_LOADER_TESTS_BACKCOMPAT to enable these tests' unless $ENV{SCHEMA_LOADER_TESTS_BACKCOMPAT}; diff --git a/t/backcompat/0.04006/13db2_common.t b/t/backcompat/0.04006/13db2_common.t index c024cd3..259b1e3 100644 --- a/t/backcompat/0.04006/13db2_common.t +++ b/t/backcompat/0.04006/13db2_common.t @@ -2,7 +2,7 @@ use strict; use lib qw(t/backcompat/0.04006/lib); use dbixcsl_common_tests; use Test::More; -plan skip_all => 'Backcompat tests disabled' +plan skip_all => 'set SCHEMA_LOADER_TESTS_BACKCOMPAT to enable these tests' unless $ENV{SCHEMA_LOADER_TESTS_BACKCOMPAT}; diff --git a/t/backcompat/0.04006/14ora_common.t b/t/backcompat/0.04006/14ora_common.t index b86a9c9..3d55602 100644 --- a/t/backcompat/0.04006/14ora_common.t +++ b/t/backcompat/0.04006/14ora_common.t @@ -2,7 +2,7 @@ use strict; use lib qw(t/backcompat/0.04006/lib); use dbixcsl_common_tests; use Test::More; -plan skip_all => 'Backcompat tests disabled' +plan skip_all => 'set SCHEMA_LOADER_TESTS_BACKCOMPAT to enable these tests' unless $ENV{SCHEMA_LOADER_TESTS_BACKCOMPAT}; diff --git a/t/backcompat/0.04006/20invocations.t b/t/backcompat/0.04006/20invocations.t index 1c05ca5..7b9944a 100644 --- a/t/backcompat/0.04006/20invocations.t +++ b/t/backcompat/0.04006/20invocations.t @@ -3,7 +3,7 @@ use Test::More; use lib qw(t/backcompat/0.04006/lib); use make_dbictest_db; use Test::More; -plan skip_all => 'Backcompat tests disabled' +plan skip_all => 'set SCHEMA_LOADER_TESTS_BACKCOMPAT to enable these tests' unless $ENV{SCHEMA_LOADER_TESTS_BACKCOMPAT}; diff --git a/t/backcompat/0.04006/21misc_fatal.t b/t/backcompat/0.04006/21misc_fatal.t index 77d1611..a0db0eb 100644 --- a/t/backcompat/0.04006/21misc_fatal.t +++ b/t/backcompat/0.04006/21misc_fatal.t @@ -3,7 +3,7 @@ use Test::More; use lib qw(t/backcompat/0.04006/lib); use make_dbictest_db; use Test::More; -plan skip_all => 'Backcompat tests disabled' +plan skip_all => 'set SCHEMA_LOADER_TESTS_BACKCOMPAT to enable these tests' unless $ENV{SCHEMA_LOADER_TESTS_BACKCOMPAT}; diff --git a/t/backcompat/0.04006/22dump.t b/t/backcompat/0.04006/22dump.t index 5aa5f59..0394101 100644 --- a/t/backcompat/0.04006/22dump.t +++ b/t/backcompat/0.04006/22dump.t @@ -4,7 +4,7 @@ use lib qw(t/backcompat/0.04006/lib); use File::Path; use make_dbictest_db; use Test::More; -plan skip_all => 'Backcompat tests disabled' +plan skip_all => 'set SCHEMA_LOADER_TESTS_BACKCOMPAT to enable these tests' unless $ENV{SCHEMA_LOADER_TESTS_BACKCOMPAT}; diff --git a/t/backcompat/0.04006/23dumpmore.t b/t/backcompat/0.04006/23dumpmore.t index f207df3..b4681b3 100644 --- a/t/backcompat/0.04006/23dumpmore.t +++ b/t/backcompat/0.04006/23dumpmore.t @@ -5,7 +5,7 @@ use File::Path; use make_dbictest_db; require DBIx::Class::Schema::Loader; use Test::More; -plan skip_all => 'Backcompat tests disabled' +plan skip_all => 'set SCHEMA_LOADER_TESTS_BACKCOMPAT to enable these tests' unless $ENV{SCHEMA_LOADER_TESTS_BACKCOMPAT}; diff --git a/t/backcompat/0.04006/lib/dbixcsl_common_tests.pm b/t/backcompat/0.04006/lib/dbixcsl_common_tests.pm index ada0338..e4e2517 100644 --- a/t/backcompat/0.04006/lib/dbixcsl_common_tests.pm +++ b/t/backcompat/0.04006/lib/dbixcsl_common_tests.pm @@ -113,6 +113,13 @@ sub run_tests { $classes->{$table_name} = $schema_class . q{::} . $source_name; } +# for debugging... +# { +# mkdir '/tmp/HLAGH'; +# $conn->_loader->{dump_directory} = '/tmp/HLAGH'; +# $conn->_loader->_dump_to_dir(values %$classes); +# } + my $moniker1 = $monikers->{loader_test1}; my $class1 = $classes->{loader_test1}; my $rsobj1 = $conn->resultset($moniker1);