Next Trivial Utilities 119

print: Conversion

        sub convert {
          my ($input, $new_type, $command) = @_;
          my $output = tempfile($new_type);
          local (*R, *W, *F);
          subst($command, 'I', $input);
          subst($command, 'O', $output);
          warn "*** Running command $command\n" if $opt_v;
          unless (system($command) == 0) {
            exit $? if $? & 255;        # catch signals
            warn "command returned failure status $?; skipping";
            return;
          }
          push @TMPFILES, $output;
          return $output;
        }


Next Menu Copyright © 2012 M. J. Dominus