Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Tacking a function on to STDOUT?

by jorg (Friar)
on May 27, 2001 at 23:18 UTC ( [id://83653]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


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
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.