diff options
-rwxr-xr-x | iurt2 | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -161,8 +161,9 @@ $run{todo} = []; "Log file.", sub { $run{log} = pop @_; - open $run{LOG}, ">$run{log}" or die "unable to open $run{log}\n"; - print *{$run{LOG}}, "command line: @ARGV\n"; + open my $log, ">$run{log}" or die "unable to open $run{log}\n"; + $run{LOG} = sub { print $log @_ }; + print *$log, "command line: @ARGV\n"; 1; }, "Log file" ], [ "m", "media", -1, "<media 1> <media 2> ... <media 3>", @@ -254,7 +255,7 @@ $run{todo} = []; ); open(my $LOG, ">&STDERR"); -$run{LOG} = $LOG; +$run{LOG} = sub { print $LOG @_ }; print "$program_name version $VERSION\n"; #plog_init($program_name, $LOG, $run{verbose}, 1); @@ -278,7 +279,7 @@ my $configfile = "$HOME/.iurt.$run{distro_tag}.conf"; plog('DEBUG', "load config: $configfile"); my $config; if (-f $configfile) { - $config = do $configfile + $config = eval(cat_($configfile)) or die "FATAL $program_name: syntax error in $configfile"; } else { $config = {}; @@ -478,7 +479,7 @@ my $clear_cache = 1; if (-f $cachefile && $run{use_cache}) { plog('INFO', "loading cache file $cachefile"); - $cache = do $cachefile + $cache = eval(cat_($cachefile)) or plog('ERR', "FATAL: could not load cache $cachefile ($!)"); if (!$cache) { @@ -494,7 +495,7 @@ if (-f $cachefile && $run{use_cache}) { } plog('NOTIFY', "loading alternate cache file $cachefile"); - $cache = do $cachefile + $cache = eval(cat_($cachefile)) or plog('ERR', "FATAL: could not load cache $cachefile ($!)"); } $clear_cache = 0 if $cache; |