in reply to Re: Re: Re: Dumping data
in thread Dumping data

Is it just me, or does IO::Capture seem like a stupid idea?

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Dumping data
by Roger (Parson) on Jan 01, 2004 at 04:31 UTC
    If you have 100's of print statements in your code, would you rather use a transparent stub or go and modify everyone of your print statements? Please don't make such comment if you don't understand the code.

      If you have 100's of print statements in your code, would you rather use a transparent stub or go and modify everyone of your print statements?
      Neither. I'd use select.
      Please don't make such comment if you don't understand the code.
      So you don't see IO::Capture as poorly thought out (it would appear you don't understand it so well)?
        I fail to see how to print to both the file and STDOUT with a single print, given that I only want to run the script once.

        # method 1 select RESULT; print "something\n"; select STDOUT; print "something\n"; # method 2 select RESULT; do_test(); select STDOUT; do_test(); sub do_test { print "something\n"; }
        I am a lazy programmer, I would prefer to simply cut and paste the stub to the start of the code, instead of trying to work out where to insert select. I know IO::Capture has limitations, but I like a solution that will leave the original code untouched as much as possible.