|
|
| 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.
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
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||