Commits

Shlomi Fish  committed 025a664

Refactored the out_script function.

git-svn-id: file:///home/shlomif/Backup/svn-dumps/google-code/svnsync-repos/fc-solve/trunk@679 e7e8a897-7ba4-4ee7-b36f-f4c66519b19a

  • Participants
  • Parent commits f62aac7

Comments (0)

Files changed (1)

File fc-solve/presets/soft-threads/meta-moves/auto-gen/Shlomif/FCS/CalcMetaScan/CmdLine.pm

 
 use base 'Shlomif::FCS::CalcMetaScan::Base';
 
-use Shlomif::FCS::CalcMetaScan;
-
 use Getopt::Long;
+use IO::File;
+
+use Shlomif::FCS::CalcMetaScan;
 
 use MyInput;
 
     return [(350) x 5000];
 }
 
+sub get_script_fh
+{
+    my $self = shift;
+    return IO::File->new(
+       ($self->output_filename() eq "-") ?
+           ">&STDOUT" :
+           ($self->output_filename(), "w")
+       );
+}
+
+sub get_script_terminator
+{
+    return "\n\n\n";
+}
+
 sub out_script
 {
     my $self = shift;
     my $cmd_line_string = shift;
 
-    my $fh;
-    if ($self->output_filename() eq "-")
-    {
-        open $fh, ">&STDOUT";
-    }
-    else
-    {
-        open $fh, ">", $self->output_filename();
-    }
-    print {$fh} $cmd_line_string, "\n\n\n";
-
-    close($fh);
+    $self->get_script_fh()->print(
+        $cmd_line_string, 
+        $self->get_script_terminator($cmd_line_string)
+    );
 }
 
 sub get_line_of_command