Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Need Help: Capture STDOUT without Redirecting

by jpeg (Chaplain)
on May 04, 2006 at 21:20 UTC ( [id://547526]=note: print w/replies, xml ) Need Help??


in reply to Need Help: Capture STDOUT without Redirecting

I feel dirty for even suggesting it, but perldoc perlsub tells you how to override builtin functions. I hacked up an example overriding 'print' that called CORE::print twice - once to STDOUT and once to a filehandle, so I know 'print' can be overridden. That won't work for you: I needed to call my print as &print and you said you've no access to the sub.

I feel even dirtier suggesting you look into importing your print function into CORE::GLOBAL.

It's definitely dangerous, but hey, the functionality is there.

--
jpg
  • Comment on Re: Need Help: Capture STDOUT without Redirecting

Replies are listed 'Best First'.
Re^2: Need Help: Capture STDOUT without Redirecting
by ikegami (Patriarch) on May 04, 2006 at 22:13 UTC
    You can't override print, because of its weird syntax for accepting file handles. You can create functions called print, of course, but you can't override print. That's why you had to change print to &print.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (5)
As of 2024-04-24 19:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found