remove unnecessary if statement
Rafael Kitover [Sun, 3 Jan 2010 21:04:46 +0000 (21:04 +0000)]
lib/DBIx/Class/Schema/Loader/Base.pm

index 08a7e4f..8c82515 100644 (file)
@@ -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);