Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Tacking a function on to STDOUT?

by jorg (Friar)
on May 28, 2001 at 03:18 UTC ( [id://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 ?

Jorg

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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (10)
As of 2024-04-16 11:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found