Merge 'trunk' into 'current'
Brandon Black [Wed, 15 Nov 2006 14:16:05 +0000 (14:16 +0000)]
r11802@moloko (orig r2879):  blblack | 2006-11-14 17:11:46 -0600
generate full class names in rel definitions (from victori)
r11845@moloko (orig r2880):  blblack | 2006-11-15 07:56:00 -0600
Fixed rt.cpan.org #22425 (use File::Spec where appropriate)
r11846@moloko (orig r2881):  blblack | 2006-11-15 07:59:31 -0600
silence the useless warning spew in 20invocations.t

Build.PL
lib/DBIx/Class/Schema/Loader/Base.pm
lib/DBIx/Class/Schema/Loader/RelBuilder.pm
t/20invocations.t

index 0f43383..e66c1c8 100644 (file)
--- 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,
@@ -29,6 +29,7 @@ my %arguments = (
         'Test::More'                    => 0.32,
         'DBI'                           => 1.50,
         'DBD::SQLite'                   => 1.12,
+        'File::Path'                    => 0,
     },
     create_makefile_pl => 'passthrough',
     create_readme      => 1,
index a9593f0..3bb81a0 100644 (file)
@@ -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;
 
 our $VERSION = '0.03999_01';
@@ -227,7 +227,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}) {
@@ -246,7 +246,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;
@@ -300,10 +300,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: $!";
         }
index 84d74f6..5ccb769 100644 (file)
@@ -191,7 +191,7 @@ sub generate_code {
             push(@{$all_code->{$local_class}},
                 { method => 'belongs_to',
                   args => [ $remote_relname,
-                            $remote_moniker,
+                            $remote_class,
                             \%cond,
                   ],
                 }
@@ -200,7 +200,7 @@ sub generate_code {
             push(@{$all_code->{$remote_class}},
                 { method => 'has_many',
                   args => [ $local_relname,
-                            $local_moniker,
+                            $local_class,
                             \%rev_cond,
                   ],
                 }
index fdab791..f239acf 100644 (file)
@@ -3,6 +3,8 @@ use Test::More;
 use lib qw(t/lib);
 use make_dbictest_db;
 
+$SIG{__WARN__} = sub { }; # Suppress warnings, as we test a lot of deprecated stuff here
+
 # Takes a $schema as input, runs 4 basic tests
 sub test_schema {
     my ($testname, $schema) = @_;