I
Ilias Lazaridis
I use the following code to redirect the stdout to a variable, which I
send then via email.
my $failure;
my $messages;
if ($notify_to_email) {
$self->output($messages); # currently not used
my $handle = IO::String->new($messages);
my $handle_old = select($handle); # redirect STDOUT
$failure = $self->check_tree($self); # prints to STDOUT,
either screen or $messages
select($handle_old) if defined $handle_old; # restore STDOUT
}else {
$failure = $self->check_tree($self);
}
$self->notify($failure, $notify_to_email, "", $messages);
The code depends on IO::String.
Can I achieve the above without the use of IO::String (and without
changing the programm structure much)?
..
send then via email.
my $failure;
my $messages;
if ($notify_to_email) {
$self->output($messages); # currently not used
my $handle = IO::String->new($messages);
my $handle_old = select($handle); # redirect STDOUT
$failure = $self->check_tree($self); # prints to STDOUT,
either screen or $messages
select($handle_old) if defined $handle_old; # restore STDOUT
}else {
$failure = $self->check_tree($self);
}
$self->notify($failure, $notify_to_email, "", $messages);
The code depends on IO::String.
Can I achieve the above without the use of IO::String (and without
changing the programm structure much)?
..