X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FApp%2FMusicExpo.pm;h=42526fa749045cc5c48326874770c78427e7ca38;hb=fb015c820358882b679ab02746043d74ea7764ee;hp=475ef80f971dba4595ef3975a2637f997e9d531d;hpb=e0fa307063761968a2fe530c5f27e002aa8bdd8c;p=app-musicexpo.git diff --git a/lib/App/MusicExpo.pm b/lib/App/MusicExpo.pm index 475ef80..42526fa 100644 --- a/lib/App/MusicExpo.pm +++ b/lib/App/MusicExpo.pm @@ -19,15 +19,13 @@ use Storable qw/thaw freeze/; my $default_template; our $prefix='/music/'; -our $cache='cache.db'; -our $caching=1; +our $cache=''; our $template=''; GetOptions ( "template=s" => \$template, "prefix=s" => \$prefix, "cache=s" => \$cache, - "caching!" => \$caching, ); @@ -76,9 +74,9 @@ sub normalizer{ } sub run { - tie my %cache, 'DB_File', $cache, O_RDWR|O_CREAT, 0644 if $caching; - memoize 'flacinfo', NORMALIZER => \&normalizer, LIST_CACHE => 'MERGE', SCALAR_CACHE => [HASH => \%cache] if $caching; - memoize 'mp3info' , NORMALIZER => \&normalizer, LIST_CACHE => 'MERGE', SCALAR_CACHE => [HASH => \%cache] if $caching; + 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 ''; my @files; for my $file (@ARGV) { @@ -147,11 +145,7 @@ Prefix for download links. Defaults to '/music/'. =item B<--cache> I -Path to the cache file. Created if it does not exist. Defaults to 'cache.db' - -=item B<--caching>, B<--no-caching> - -Enables or disables caching. Defaults to B<--caching> +Path to the cache file. Created if it does not exist. If '' (empty), disables caching. Is empty by default. =back