From cc5d06b5c1cb910dd20e39a43a399dd1652f926d Mon Sep 17 00:00:00 2001 From: Marius Gavrilescu Date: Sat, 25 Oct 2014 12:33:10 +0300 Subject: [PATCH] Clean up memoize calls --- lib/App/MusicExpo.pm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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) { -- 2.39.2