sub run_filter {
my ($cmd, $src, $dest) = @_;
- local *SRC, *CMD;
- open(CMD, "|$cmd >$dest") || die "Cannot fork: $!";
- open(SRC, $src) || die "Cannot open $src: $!";
+ open(my $CMD, "|$cmd >$dest") || die "Cannot fork: $!";
+ open(my $SRC, $src) || die "Cannot open $src: $!";
my $buf;
my $sz = 1024;
- while (my $len = sysread(SRC, $buf, $sz)) {
- syswrite(CMD, $buf, $len);
+ while (my $len = sysread($SRC, $buf, $sz)) {
+ syswrite($CMD, $buf, $len);
}
- close SRC;
- close CMD or die "Filter command '$cmd' failed for $src";
+ close $SRC;
+ close $CMD or die "Filter command '$cmd' failed for $src";
}
sub pm_to_blib {