Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

RE: Filter::Handle

by mirod (Canon)
on Sep 11, 2000 at 21:26 UTC ( #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? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2021-12-08 00:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (34 votes). Check out past polls.

    Notices?