Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: Tacking a function on to STDOUT?

by jorg (Friar)
on May 28, 2001 at 03:18 UTC ( #83653=note: print w/replies, xml ) Need Help??

in reply to Tacking a function on to STDOUT?

You're kind of suggesting the right solution already. The best way to do this is to make a  sub printfiltered {} that filters the text you want to print before printing it to STDOUT. This leaves you with the flexibility of still printing the 'unfiltered' way to STDOUT by just calling print.
Doing this the true object oriented way, one would override the print method but i'm not sure if perl allows you to do that. (pretty sure it does not actually)
There *might* be a way of redirecting STDOUT to a variable and then have a separate process checking that variable every other millisecond to filter it and print it to STDOUT, but let's keep things simple and maintainable shall we ?


"Do or do not, there is no try" -- Yoda

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2021-09-19 12:28 GMT
Find Nodes?
    Voting Booth?

    No recent polls found