D-oh
(
C/CN/CNANDOR/D-oh-1.01.tar.gz, CNANDOR, 2018;
MetaCPAN
)
use File::Basename;
use File::Spec::Functions qw(catfile tmpdir);
use Carp;
use IO::Handle;
use JSON;
use Time::HiRes 'gettimeofday';
use parent 'Exporter';
our @EXPORT_OK;
our $VERSION = '1.01';
{
$data = $_[0];
}
else {
$data = [$_[0]];
}
print STDERR encode_json($data), "\n";
}
sub date {
my($fh) = ($_[0] && $_[0] =~ /^STDOUT$/i ? 'STDOUT' : 'STDERR');
a timestamp to STDERR (C<date('STDOUT')> prints it to STDOUT).
You can also dump random data as JSON to STDERR by calling any function name you want. Just import the name you want to use.
=head1 A