]> iEval git - app-musicexpo.git/blobdiff - lib/App/MusicExpo.pm
Use \. in extension regexes
[app-musicexpo.git] / lib / App / MusicExpo.pm
index ef99911562494db12f098cdc34bd9016ce0d12bd..7b5f4e2f46d7ba70d0bcb3b7852f03d1b81afb9c 100644 (file)
@@ -3,7 +3,7 @@ use v5.14;
 use strict;
 use warnings;
 
-our $VERSION = '0.003002';
+our $VERSION = '0.003003';
 
 use Audio::FLAC::Header qw//;
 use HTML::Template::Compiled qw//;
@@ -98,17 +98,17 @@ sub normalizer{
 }
 
 sub run {
-       tie my %cache, 'DB_File', $cache, O_RDWR|O_CREAT, 0644 unless $cache eq '';
-       memoize 'flacinfo', NORMALIZER => \&normalizer, LIST_CACHE => 'MERGE', SCALAR_CACHE => [HASH => \%cache] unless $cache eq '';
-       memoize 'mp3info' , NORMALIZER => \&normalizer, LIST_CACHE => 'MERGE', SCALAR_CACHE => [HASH => \%cache] unless $cache eq '';
-       memoize 'vorbisinfo' , NORMALIZER => \&normalizer, LIST_CACHE => 'MERGE', SCALAR_CACHE => [HASH => \%cache] unless $cache eq '';
+       if ($cache) {
+               tie my %cache, 'DB_File', $cache, O_RDWR|O_CREAT, 0644;
+               memoize $_, NORMALIZER => \&normalizer, LIST_CACHE => 'MERGE', SCALAR_CACHE => [HASH => \%cache] for qw/flacinfo mp3info vorbisinfo/;
+       }
 
        my %files;
        for my $file (@ARGV) {
                my $info;
-               $info = thaw flacinfo $file if $file =~ /.flac$/i;
-               $info = thaw mp3info $file if $file =~ /.mp3$/i;
-               $info = thaw vorbisinfo $file if $file =~ /.og(?:g|a)$/i;
+               $info = thaw flacinfo $file if $file =~ /\.flac$/i;
+               $info = thaw mp3info $file if $file =~ /\.mp3$/i;
+               $info = thaw vorbisinfo $file if $file =~ /\.og(?:g|a)$/i;
                next unless defined $info;
                my $basename = fileparse $file, '.flac', '.mp3', '.ogg', '.oga';
                $files{$basename} //= [];
This page took 0.02502 seconds and 4 git commands to generate.