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

Re^2: Override printing to STDOUT/ERR

by perlancar (Friar)
on Dec 20, 2018 at 15:34 UTC ( #1227532=note: print w/replies, xml ) Need Help??


in reply to Re: Override printing to STDOUT/ERR
in thread Override printing to STDOUT/ERR

While Capture::Tiny is simpler, the OP wanted to separate output according to the package/file the print() originates. So in this case, a tie-based solution like Tie::STDOUT is more appropriate as it lets you call your custom code on every print() or printf() or syswrite(), and then you can use caller() to extract the source location of each print() and act accordingly.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2020-10-25 06:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favourite web site is:












    Results (249 votes). Check out past polls.

    Notices?