Hi! I want to print test::more is_deeply's output to a log file or conjure some other way to notify via email when any one test fails. Please share your ideas? Thank you!
use strict; use warnings; use File::Find; use Mail::Mailer; use Test::More tests => 2; use vars ('*name', '*dir', '*prune'); *name = *File::Find::name; *dir = *File::Find::dir; *prune = *File::Find::prune; $| = 1; #snip #.... my $runlog = qq(/var/log/stgpool_lun_compare.log); my $errlog = qq(/var/log/stgpool_lun_compare.errlog); my (%lsmap15a,$lsm15a,$client15a,$status15a,$bdev15a,$lsmap15a); my (%lsmap15b,$lsm15b,$client15b,$status15b,$bdev15b,$lsmap15b); my (%lsmap16a,$lsm16a,$client16a,$status16a,$bdev16a,$lsmap16a); my (%lsmap16b,$lsm16b,$client16b,$status16b,$bdev16b,$lsmap16b,$mesg); open ( RLOG, "+>", $runlog ) or warn "$runlog did not open $!\n"; open ( ELOG, "+>", $errlog ) or warn "$errlog did not open $!\n"; my $regex = qr/\-$|^svsa.*$|^mirrored.*|^physloc.*|^$/i; open (LSMAP16B, "+< $lsmap16b") or die $!; while ( $lsm16b = (<LSMAP16B>) ) { next if $lsm16b =~ m/$regex/; if ( $lsm16b =~ m/vtopt\d+/i ) { my $skip = 3; <LSMAP16B> while $skip-- >0 and not eof LSMAP16B; next; } if ( $lsm16b =~ /^vhost\d+\s+\w+\.\d+\w\.\w+\-\w+\-\w+\s+(0x\w+$)/ +i ) { $client16b = $1; } if ( $lsm16b =~ /^status\s+(\w+$)/i ) { $status16b = $1; push ( @{$lsmap16b{$client16b}}, $status16b ); next; } if ( $lsm16b =~ /^backing\sdevice\s+(\w+_\w+\.\w+$)/i ) { $bdev16b = $1; push ( @{$lsmap16b{$client16b}}, $bdev16b ); next; } } ### These 2 print lines below are not printing to the log ### print RLOG is_deeply(\%lsmap16a, \%lsmap16b, 'vios16a-vios16b-map-comp +are' ); print ELOG grep {/failed.*/i}<RLOG>; __STDOUT__ # Failed test 'vios16a-vios16b-map-compare' # at stgpool_lun_compare.plx line 194. # Structures begin differing at: # $got->{0x00000012}[1] = 'twcsapxrqdb1_r1.c24452093bce96e2f4 +8808ed3f7d7eab' # $expected->{0x00000012}[1] = 'twcsapxrqdb1_r1.c24452093bce96e2f4 +8808ed3f7d7eac' $VAR1 = { '0x00000019' => [ 'Available', 'sapepd00_r1.b2094c34c4a13b0a726a39f92a9e9 +ed7', 'Available', 'sapepd00_r2.96db0cd89258769f4ab05247ac2b3 +fa2', 'Available', 'sapepd00_e1.b56cbd304aa61c6ca9ae9edc1b68b +5e4', 'Available', 'sapepd00_e2.f41786148a3beeeef9c7b1b53fe54 +0e8', 'Available', 'sapepd00_p1.4a2facfe0f6f4237817de94c06f2f +ccd' ], '0x00000012' => [ 'Available', 'twcsapxrqdb1_r1.c24452093bce96e2f48808ed3 +f7d7eab', 'Available', 'twcsapxrqdb1_r2.dd39252cef8d45a4c24d59be4 +38ef60d', 'Available', 'twcsapxrqdb1_x1.4d9b58368e93e12fa7ab4a2d1 +950ec13', 'Available', 'twcsapxrqdb1_x2.51369af641d03701e977f7e95 +0c00905', 'Available', 'twcsapxrqdb1_x3.24ebd57b77a43ba21d46da58c +7fa5323', 'Available', 'twcsapxrqdb1_p1.60dc076867436ed6af776adb4 +05fe269' ] };

In reply to getting is_deeply test::more to print to log by teamassociated

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.