dtrt when previous dumpfile was not generated by us
Brandon Black [Fri, 30 Mar 2007 05:25:14 +0000 (05:25 +0000)]
lib/DBIx/Class/Schema/Loader/Base.pm

index e5ff802..ce81c5f 100644 (file)
@@ -368,9 +368,7 @@ sub _write_classfile {
         unlink($filename);
     }    
 
-    my $custom_content = (-f $filename)
-        ? $self->_get_custom_content($filename)
-        : undef;
+    my $custom_content = $self->_get_custom_content($filename);
 
     $custom_content ||= qq|\n# You can replace this text with custom|
         . qq| content, and it will be preserved on regeneration|
@@ -427,8 +425,10 @@ sub _get_custom_content {
         }
     }
 
-    if(!$found) {
-    }
+    croak "Cannot not overwrite '$filename' without 'dump_overwrite',"
+        " it does not appear to have been generated by Loader";
+            if !$found;
+
     return $buffer;
 }