beadon has asked for the wisdom of the Perl Monks concerning the following question:
use strict; use IO::Tee; my $email_body; open BODY , ">", \$email_body or die "Unable to store to a var : $!\n" +; my $tee = IO::Tee->new (\*STDOUT,\*BODY); # create a new tee object +and attach STDOUT and the email buffer to it. $tee->autoflush(1); my ( $check_description,$check_result,$severity_w ); my $VERSION = 10.0; my $host = "test"; format HEADER = ____v@<<<< @<<<<<<<<<<<_______________________________________________ +______________________________________________ $VERSION, $host Description + Check Result - Status-Severity ______________________________________________________________________ +______________________________________________ . format FAIL = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @>>>>>>>>>>>>>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> -ERROR-@> $check_description,$check_result,$severity_w . format STD = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @>>>>>>>>>>>>>>>>>>>>>>>>>>> +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> $check_description,$check_result . select ($tee); # select the default FH $^ = 'HEADER'; # set the top of page format $~ = 'FAIL'; $check_description = "desc"; $check_result = "result"; $severity_w = "9"; write;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: IO::Tee and write / format
by Illuminatus (Curate) on Oct 17, 2008 at 02:12 UTC | |
by ikegami (Patriarch) on Oct 17, 2008 at 04:03 UTC | |
by Anonymous Monk on Oct 17, 2008 at 05:13 UTC | |
by sflitman (Hermit) on Oct 17, 2008 at 06:01 UTC | |
Re: IO::Tee and write / format
by broomduster (Priest) on Oct 17, 2008 at 13:24 UTC | |
by beadon (Initiate) on Oct 17, 2008 at 17:28 UTC | |
by broomduster (Priest) on Oct 17, 2008 at 19:36 UTC | |
Re: IO::Tee and write / format
by ikegami (Patriarch) on Oct 17, 2008 at 06:34 UTC | |
Re: IO::Tee and write / format
by salva (Canon) on Oct 17, 2008 at 08:42 UTC |