From: Rafael Kitover Date: Sun, 3 Jan 2010 21:04:46 +0000 (+0000) Subject: remove unnecessary if statement X-Git-Tag: 0.04999_14~17 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e1373c52a2c94d82334371f5b6bb3bd70ac320c9;p=dbsrgits%2FDBIx-Class-Schema-Loader.git remove unnecessary if statement --- diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 08a7e4f..8c82515 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -913,25 +913,21 @@ sub _write_classfile { my ($custom_content, $old_md5, $old_ver, $old_ts) = $self->_get_custom_content($class, $filename); - if ($self->_upgrading_from) { - my $old_class = $self->_upgrading_classes->{$class}; + if (my $old_class = $self->_upgrading_classes->{$class}) { + my $old_filename = $self->_get_dump_filename($old_class); - if ($old_class && ($old_class ne $class)) { - my $old_filename = $self->_get_dump_filename($old_class); - - my ($old_custom_content) = $self->_get_custom_content( - $old_class, $old_filename, 0 # do not add default comment - ); - - $old_custom_content =~ s/\n\n# You can replace.*\n1;\n//; + my ($old_custom_content) = $self->_get_custom_content( + $old_class, $old_filename, 0 # do not add default comment + ); - if ($old_custom_content) { - $custom_content = - "\n" . $old_custom_content . "\n" . $custom_content; - } + $old_custom_content =~ s/\n\n# You can replace.*\n1;\n//; - unlink $old_filename; + if ($old_custom_content) { + $custom_content = + "\n" . $old_custom_content . "\n" . $custom_content; } + + unlink $old_filename; } $custom_content = $self->_rewrite_old_classnames($custom_content);