in reply to STDOUT::Capture - manipulate STDOUT
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re(2): STDOUT::Capture - manipulate STDOUT
by Dog and Pony (Priest) on Jun 09, 2002 at 21:55 UTC | |
First off, I want to limit myself to STDOUT, in this case, because I want the impact on the original script to be as small as possible - ie, I'd like it to just be an extra use line that I can insert into each script. But anyways, here is how it all worked out for me: I could, after some tinkering, accomplish the same thing with Tie::Handle::Scalar, as I do now. I'll just throw up the code right away: I put this in a module, and used it instead of the original example file - the sub routine is the exact same, so I could compare results. The above code does work, and comparatively, it uses about one third of the code in my module to do the same thing. But I do have some issues with it - you be the judge if I am just defending my code, or if I have any substance in these "complaints". :)
Not big things, I guess, but it does a lot I don't need, in probably too general ways, plus I'd want that wrapper anyways. It could have saved me some POD writing though, if I wanted a one-time solution. It would most certainly work. IO::String and IO::Stringy I am less certain about. I couldn't get either to do this at all. Possibly because I don't understand the terse docs, but I tried most possible combinations of what was there at least. It is possible that it isn't meant to do this exact thing too, and equally possible I am doing it wrong. Most things still apply though, it would take an extra wrapper to get it where I want, etc. Well, I guess my petty "defence" is that I wanted something that did something, that something only, and did it good while being easy to use. If I succeeded is another matter entirely. I did lots of searches for something that could do this, and I *still* missed those modules, that is almost unbelievable. Especially since I searched the Tie::* modules pretty good. Guess I didn't look closely enough at exactly what modules did. Again, thanks for pointing these out to me. I'd still stick with what I wrote, now that it is written, but I might have reconsidered had I found this. Not that it matters, writing code is what is fun after all. :) You have moved into a dark place. It is pitch black. You are likely to be eaten by a grue. | [reply] [d/l] |
by Anonymous Monk on Jun 10, 2002 at 01:53 UTC | |
| [reply] [d/l] |
by Dog and Pony (Priest) on Jun 10, 2002 at 07:04 UTC | |
What I want is to have little to none impact on my existing programs, codewise, not even a callback copied into them (not to mention the potential maintenance nightmare). :) Anyhow, now I think which approach should be taken, depends on if one foresee any added functionality in the future that could benefit from the extra functionality in Tie::Handle::Scalar, or not. Can't come up with anything at the moment, but there is probably something. Thanks for the example... I have some more zzz to catch, but I'll look more closely later. :) You have moved into a dark place. It is pitch black. You are likely to be eaten by a grue. | [reply] |