From: Marius Gavrilescu Date: Sat, 25 Oct 2014 09:33:10 +0000 (+0300) Subject: Clean up memoize calls X-Git-Tag: 0.004~6 X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=cc5d06b5c1cb910dd20e39a43a399dd1652f926d;p=app-musicexpo.git Clean up memoize calls --- diff --git a/lib/App/MusicExpo.pm b/lib/App/MusicExpo.pm index ee8a8f5..e9c0b95 100644 --- a/lib/App/MusicExpo.pm +++ b/lib/App/MusicExpo.pm @@ -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) {