From: Brandon Black Date: Wed, 15 Nov 2006 13:56:00 +0000 (+0000) Subject: Fixed rt.cpan.org #22425 (use File::Spec where appropriate) X-Git-Tag: 0.03009~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dd03ee1aa3dd9f2be1dabd0d36fcb374747e2d53;p=dbsrgits%2FDBIx-Class-Schema-Loader.git Fixed rt.cpan.org #22425 (use File::Spec where appropriate) --- diff --git a/Build.PL b/Build.PL index 3d6a393..801579c 100644 --- a/Build.PL +++ b/Build.PL @@ -5,7 +5,7 @@ my %arguments = ( license => 'perl', module_name => 'DBIx::Class::Schema::Loader', requires => { - 'Cwd' => 0, + 'File::Spec' => 0, 'Scalar::Util' => 0, 'Data::Dump' => 1.06, 'UNIVERSAL::require' => 0.10, @@ -30,6 +30,7 @@ my %arguments = ( 'Test::More' => 0.32, 'DBI' => 1.50, 'DBD::SQLite' => 1.12, + 'File::Path' => 0, }, create_makefile_pl => 'passthrough', create_readme => 1, diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index cf67db0..6b89a29 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -9,7 +9,7 @@ use UNIVERSAL::require; use DBIx::Class::Schema::Loader::RelBuilder; use Data::Dump qw/ dump /; use POSIX qw//; -use Cwd qw//; +use File::Spec qw//; require DBIx::Class; __PACKAGE__->mk_ro_accessors(qw/ @@ -266,7 +266,7 @@ sub _load_external { my $abs_dump_dir; - $abs_dump_dir = Cwd::abs_path($self->dump_directory) + $abs_dump_dir = File::Spec->rel2abs($self->dump_directory) if $self->dump_directory; foreach my $table_class (values %{$self->classes}) { @@ -285,7 +285,7 @@ sub _load_external { my $class_path = $table_class; $class_path =~ s{::}{/}g; $class_path .= '.pm'; - my $filename = Cwd::abs_path($INC{$class_path}); + my $filename = File::Spec->rel2abs($INC{$class_path}); croak 'Failed to locate actual external module file for ' . "'$table_class'" if !$filename; @@ -339,10 +339,12 @@ sub _ensure_dump_subdirs { my ($self, $class) = (@_); my @name_parts = split(/::/, $class); - pop @name_parts; + pop @name_parts; # we don't care about the very last element, + # which is a filename + my $dir = $self->dump_directory; foreach (@name_parts) { - $dir .= q{/} . $_; + $dir = File::Spec->catdir($dir,$_); if(! -d $dir) { mkdir($dir) or croak "mkdir('$dir') failed: $!"; }