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;
In reply to IO::Tee and write / format by beadon
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |