in reply to Filter::Handle

I have just one question: how does this compare to using a magic open?

A magic open is a really cool Perl feature that let you... set a filter on a file! Just like this:

#!/bin/perl -w use strict; set_filter(); # sets the post-processing filter print "main processing is here\n"; print "and continues here\n"; exit; BEGIN { my $i=1; sub set_filter { return if my $pid= open( STDOUT, "|-"); # magic open die "cannot fork: $!" unless defined $pid; while( <STDIN>) { printf "line %03d: %s", $i++, $_; } exit; } }

Replies are listed 'Best First'.
RE: RE: Filter::Handle
by merlyn (Sage) on Sep 11, 2000 at 21:31 UTC