Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

RE: Filter::Handle

by mirod (Canon)
on Sep 11, 2000 at 21:26 UTC ( [id://31935]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://31935]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-20 01:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found