in reply to How can I inject colored output to prove command output?
Modifying my module to use diag instead of print did the trick:
ackage Test::Utils::Dump; use Term::ANSIColor qw(colored); use Test::More; use strict; use Data::Dumper qw(Dumper); # export the dump function use Exporter qw(import); our @EXPORT_OK = qw(d); $Data::Dumper::Indent = 2; $Data::Dumper::Terse = 1; # dump the data passed in sub d { my $data = shift; my $out = ''; # print the data and the caller $caller_line = "Dump from: " . (caller(0))[1] . ' line: ' . (caller(0))[2]; diag colored(['yellow'], $caller_line); diag colored(['blue'], Dumper($data)); diag colored(['yellow'], $caller_line); }
$PM = "Perl Monk's";
$MC = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar Parson";
$nysus = $PM . ' ' . $MC;
Click here if you love Perl Monks
|
|---|