Clean up memoize calls
authorMarius Gavrilescu <marius@ieval.ro>
Sat, 25 Oct 2014 09:33:10 +0000 (12:33 +0300)
committerMarius Gavrilescu <marius@ieval.ro>
Sat, 25 Oct 2014 09:33:10 +0000 (12:33 +0300)
lib/App/MusicExpo.pm

index ee8a8f54b64d9613a5cf785a4b0037574d2ba774..e9c0b9579e5556e2839a860ce2aa727ec46bf549 100644 (file)
@@ -98,10 +98,10 @@ 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) {
This page took 0.011198 seconds and 4 git commands to generate.