Dr. Poo wrote:
> What i am trying to do is set up a very rudimentary logging system. I want
> to log everything that is directed to STDOUT. And the way i'd like to try
> to do this is have an array declared that will "read" STDOUT and store the
> contents to the array rather than print them to the screen. (or they can
> go to the screen too... but i'd rather them not.)
There's loads of logging modules on CPAN, I've been using Log::Dispatch
lately, and that seems to work well.
As for sending STDOUT to a scalar, you can use tie...
,----[ sample ]
| package Catch;
| our @buffer;
|
| sub TIEHANDLE {
| return bless {}, shift;
| }
|
| sub PRINT {
| my $self = shift;
| push @buffer, @_;
| }
|
| package main;
|
| tie *STDOUT, 'Catch';
|
| print "hello";
| print "foo";
|
| my @contents = @Catch::buffer;
|
| print STDERR @contents;
`----
That might do what you want...
> PS. To the ones who do most of the answering and helping on this list...
> How many years (roughly) have you all been "perling"? Cause i'd really
I don't do most of the answering, just drop in every now and again, but
commercially roughly 5 or 6 years.
--
Daniel Gardner
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]