From: Brandon Black Date: Fri, 30 Mar 2007 05:25:14 +0000 (+0000) Subject: dtrt when previous dumpfile was not generated by us X-Git-Tag: 0.03999_01~15 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5ef3c77196cf3039d091387fa2089c02a421f6a1;p=dbsrgits%2FDBIx-Class-Schema-Loader.git dtrt when previous dumpfile was not generated by us --- diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index e5ff802..ce81c5f 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -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; }