photo-stats

Unnamed repository; edit this file 'description' to name the repository.
git clone git://code.clttr.info/photo-stats.git
Log | Files | Refs | README | LICENSE

commit 09a46abda398e5d4d20f63925851b0bd1dd923c1
parent b061e9c222703de6d96883eaa4263eb1b74a457d
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 @@ -132,6 +132,8 @@ sub getaliases return @aliases; } +sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s }; + sub create_db { my ($dbfile) = @_; @@ -159,10 +161,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;