photo-stats

statistics processor for the terminal
git clone https://git.clttr.info/photo-stats.git
Log (Feed) | Files | Refs (Tags) | README | LICENSE

commit f0e39d78d92a5033c651c02ce86863b20b2ce515
parent 4f758269fd99d5b3717729f669d1e4082c2ce768
Author: René Wagner <rwagner@rw-net.de>
Date:   Fri, 14 Aug 2020 10:52:25 +0200

provide basic formatting

Diffstat:
Mphosta.pl | 10+++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/phosta.pl b/phosta.pl @@ -9,6 +9,7 @@ no warnings 'experimental'; use strict; use feature qw(say); use POSIX qw(lround); +use Text::SimpleTable::AutoWidth; use Scalar::Util qw(looks_like_number); use Cwd; use DBI; @@ -124,15 +125,18 @@ sub query_db say "Querying local database with $total_count entries..."; say ''; + my $tb = Text::SimpleTable::AutoWidth->new(); + #say get_sql($selected, $grouping); my $stmt = $dbh->prepare(get_sql($selected, $grouping)); - my @row; $stmt->execute(); - while (@row = $stmt->fetchrow_array) + while (my @row = $stmt->fetchrow_array) { - print join(", ", @row), "\n"; + $tb->row(@row); } + $tb->captions($stmt->{NAME}); + say $tb->draw; $dbh->disconnect(); }