photo-stats

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

commit 242677d8d21a63f909d7579740edb4af8c4ebf81
parent f58f535eeaec9d199a2d63ae2fd6ebe16972534a
Author: René Wagner <rwagner@rw-net.de>
Date:   Sat, 26 Sep 2020 10:33:47 +0200

trim leading/trailing whitespaces

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

diff --git a/phosta.pl b/phosta.pl @@ -137,6 +137,8 @@ sub getaliases return @aliases; } +sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s }; + sub create_db { my ($dbfile) = @_; @@ -164,10 +166,13 @@ sub populate foreach (@lines) { chomp $_; - my ($file, $maker, $model, $lensmake, $lens, $lensmodel, $fl, $fl35, $apert, $exposuretime, $ss, $iso, $flash, $datetimeoriginal) = split(/#/, $_); + + my @line = split(/#/, $_); + map { s/^\s+|\s+$//g; } @line; + my ($file, $maker, $model, $lensmake, $lens, $lensmodel, $fl, $fl35, $apert, $exposuretime, $ss, $iso, $flash, $datetimeoriginal) = @line; my @forbidden_content = ('Unknown', 'N/A', '-', ''); - + $maker !~ @forbidden_content or $maker = '-'; $model !~ @forbidden_content or $model = '-'; $lens = ($lens ~~ @forbidden_content) ? $lensmodel : $lens;