From: Brandon Black Date: Thu, 12 Oct 2006 15:47:58 +0000 (+0000) Subject: fix for rt.cpan.org #21084 (dump_overwrite pathological output recursion), bump versi... X-Git-Tag: 0.03008~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=88603c41b34916b75481afbcb7c109d33300f2a5;p=dbsrgits%2FDBIx-Class-Schema-Loader.git fix for rt.cpan.org #21084 (dump_overwrite pathological output recursion), bump version to 0.03007_01 temporarily for testing prior to 0.03008 release --- diff --git a/Build.PL b/Build.PL index dac3ee3..3d6a393 100644 --- a/Build.PL +++ b/Build.PL @@ -5,6 +5,7 @@ my %arguments = ( license => 'perl', module_name => 'DBIx::Class::Schema::Loader', requires => { + 'Cwd' => 0, 'Scalar::Util' => 0, 'Data::Dump' => 1.06, 'UNIVERSAL::require' => 0.10, diff --git a/Changes b/Changes index 4f93414..958893b 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,11 @@ Revision history for Perl extension DBIx::Class::Schema::Loader +0.03008 XXX Not yet released + - fix for rt.cpan.org #21084 (dump_overwrite pathological output recursion) + - fix for rt.cpan.org #21758 (mysql reserved words as table names) + - fix for rt.cpan.org #21025 (SQLite FK parsing) + - workaround for rt.cpan.org #21746 ($Class::Accessor::Fast::VERSION issues) + 0.03007 Thu Jul 27 16:19:59 UTC 2006 - Kill erroneous warning about connect/loader_options order (the real case is warned about elsewhere) diff --git a/lib/DBIx/Class/Schema/Loader.pm b/lib/DBIx/Class/Schema/Loader.pm index 07dca92..afa147c 100644 --- a/lib/DBIx/Class/Schema/Loader.pm +++ b/lib/DBIx/Class/Schema/Loader.pm @@ -12,7 +12,7 @@ use Scalar::Util qw/ weaken /; # Always remember to do all digits for the version even if they're 0 # i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports # brain damage and presumably various other packaging systems too -our $VERSION = '0.03007'; +our $VERSION = '0.03007_01'; __PACKAGE__->mk_classaccessor('dump_to_dir'); __PACKAGE__->mk_classaccessor('loader'); diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index c786457..cf67db0 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -9,6 +9,7 @@ use UNIVERSAL::require; use DBIx::Class::Schema::Loader::RelBuilder; use Data::Dump qw/ dump /; use POSIX qw//; +use Cwd qw//; require DBIx::Class; __PACKAGE__->mk_ro_accessors(qw/ @@ -263,6 +264,11 @@ sub new { sub _load_external { my $self = shift; + my $abs_dump_dir; + + $abs_dump_dir = Cwd::abs_path($self->dump_directory) + if $self->dump_directory; + foreach my $table_class (values %{$self->classes}) { $table_class->require; if($@ && $@ !~ /^Can't locate /) { @@ -275,14 +281,15 @@ sub _load_external { warn qq/# Loaded external class definition for '$table_class'\n/ if $self->debug; - if($self->dump_directory) { + if($abs_dump_dir) { my $class_path = $table_class; $class_path =~ s{::}{/}g; $class_path .= '.pm'; - my $filename = $INC{$class_path}; + my $filename = Cwd::abs_path($INC{$class_path}); croak 'Failed to locate actual external module file for ' . "'$table_class'" if !$filename; + next if($filename =~ /^$abs_dump_dir/); open(my $fh, '<', $filename) or croak "Failed to open $filename for reading: $!"; $self->_raw_stmt($table_class,