Blob Blame History Raw
--- perltetris.pl.orig	2009-04-23 03:22:43.000000000 +0900
+++ perltetris.pl	2009-04-25 03:34:38.000000000 +0900
@@ -1132,7 +1132,7 @@
     my $conf =  $start_mark . "\n" .
         Data::Dumper->Dump([$history], ['history']) .
                 $end_mark . "\n";
-    if ( -e $config_file ) {
+    if ( defined($config_file) and -e $config_file ) {
         open(my $fh, $config_file) or die "Can't open file $config_file: $!";
         while ( <$fh> ) {
             if ( /\Q$start_mark/ ) {
@@ -1152,9 +1152,11 @@
         print $out "1;\n";
     }
     close($out);
-    open(my $fh, ">$config_file") or die "Can't create file $config_file: $!";
-    print $fh $str;
-    close($fh);
+    if ( defined($config_file) ) {
+        open(my $fh, ">$config_file") or die "Can't create file $config_file: $!";
+        print $fh $str;
+        close($fh);
+    }
 }
 
 1;