File: inplace

package info (click to toggle)
libsql-abstract-perl 2.000001-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 744 kB
  • sloc: perl: 3,443; makefile: 8
file content (17 lines) | stat: -rwxr-xr-x 241 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/usr/bin/env perl

use strictures 2;
use autodie;

my ($cmd, $file, @args) = @ARGV;

my $input = do { local (@ARGV, $/) = $file; <> };

close STDOUT;
open STDOUT, '>', $file;

open $out, '|-', $cmd, @args;

print $out $input;

close $out;