changeset 125:f103beea19f4

tweak
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 03 Dec 2019 09:32:33 +0900
parents 53be0626c3fa (current diff) 004e825f37c7 (diff)
children 99be03babde3
files src/gearsTools/trans_impl.pl
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/gearsTools/trans_impl.pl	Tue Dec 03 09:31:42 2019 +0900
+++ b/src/gearsTools/trans_impl.pl	Tue Dec 03 09:32:33 2019 +0900
@@ -21,18 +21,17 @@
 
 my $output_file = $impl_file;
 $output_file =~ s/\.h/.cbc/;
-open my $fh, '>', $output_file;
-my $stdout    = $fh;
+my $stdout    = *STDOUT;
 
-unless ($opt{w}) {
-    $stdout    = *STDOUT;
+if ($opt{w}) {
+    open $stdout, '>', $output_file;
 }
 
 emit_include_part($stdout, $inter_ir->{name});
 emit_impl_header_in_comment($stdout, $impl_file);
 emit_constracutor($stdout,$impl_ir,$inter_ir);
 emit_code_gears($stdout,$impl_ir,$inter_ir);
-close $fh;
+close $stdout;
 
 sub emit_include_part {
   my ($out, $interface) = @_;