App-MonM-Notifier
view release on metacpan or search on metacpan
lib/App/MonM/Notifier/Monotifier.pm view on Meta::CPAN
# Table
my $tbl_hdrs = TABLE_INFO;
$tbl_hdrs->[1][0] = (SCREENWIDTH() - 19);
my $tbl = Text::SimpleTable->new(@$tbl_hdrs);
# Stash
my $exp = $info{expired} || 0;
$tbl->row("Id", $id);
$tbl->row("To", $info{to} // '');
$tbl->row("Channel", $info{channel} // '');
$tbl->row("Subject", encode( locale => $info{subject} // '' ));
$tbl->row("Status", $info{status} // '');
$tbl->row("Published", $info{published} ? dtf(DATE_FORMAT, $info{published}) : '');
$tbl->row("Scheduled", $info{scheduled} ? dtf(DATE_FORMAT, $info{scheduled}) : '');
$tbl->row("Expired", dtf(DATE_FORMAT, $exp)) if $exp;
$tbl->row("Sent", dtf(DATE_FORMAT, $info{sent})) if $info{sent};
$tbl->row("Attempt", $info{attempt}) if $info{attempt};
$tbl->row("Errcode", $info{errcode} // 0);
$tbl->row("Errmsg", encode( locale => $info{errmsg} // '' ));
$tbl->hr;
$tbl->row("SUMMARY", ($exp < time) ? "EXPIRED" : $info{status} // '');
say $tbl->draw();
# Show attributes (dump)
if ($self->verbosemode) {
say "Attributes of channel:";
print(explain($info{attributes}));
print "\n";
# Show message
printf("%s BEGIN MESSAGE ~~~\n", "~" x (SCREENWIDTH()-18));
say encode( locale => $info{message} // '' );
printf("%s END MESSAGE ~~~\n", "~" x (SCREENWIDTH()-16));
}
} else {
my @table = $store->getAll(ROWS_LIMIT);
return $self->raise($store->error) if $store->error;
# Check data
my $n = scalar(@table) || 0;
if ($n) {
printf("Number of records: %d\n", $n);
lib/App/MonM/Notifier/Monotifier.pm view on Meta::CPAN
[8, 'STATUS'],
[3, 'ERR'],
)];
my $tbl = Text::SimpleTable->new(@$tbl_hdrs);
my @errors;
foreach my $rec (sort {$a->[0] <=> $b->[0]} @table) {
$tbl->row(
$rec->[0] // 0, # id
variant_stf($rec->[1] // '', 20), # to
variant_stf($rec->[2] // '', 20), # channel
variant_stf(encode( locale => $rec->[3] // '' ), 32), # subject
$rec->[11] // '', # status
$rec->[12] // 0, # errcode
);
push @errors, $rec->[13] if $rec->[12];
}
say $tbl->draw();
if ($self->verbosemode && @errors) {
foreach my $err (@errors) {
say magenta($err);
}
( run in 0.905 second using v1.01-cache-2.11-cpan-ceb78f64989 )