From fb015c820358882b679ab02746043d74ea7764ee Mon Sep 17 00:00:00 2001
From: Marius Gavrilescu <Marius Gavrilescu>
Date: Sun, 18 Aug 2013 00:18:01 +0300
Subject: [PATCH] Disable caching by default, remove --caching argument

---
 lib/App/MusicExpo.pm | 16 +++++-----------
 musicexpo            | 12 ++++--------
 2 files changed, 9 insertions(+), 19 deletions(-)

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<filename>
 
-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
 
diff --git a/musicexpo b/musicexpo
index 4768424..8e7ea01 100755
--- a/musicexpo
+++ b/musicexpo
@@ -13,11 +13,11 @@ musicexpo - script which generates a HTML table of music tags
 
 =head1 SYNOPSIS
 
-    # Creates a table with the songs a.mp3 and b.flac using the default template and caching the tags in the file 'cache.db'. The download links point to /music/a.mp3 and /music/b.mp3
+    # Creates a table with the songs a.mp3 and b.flac using the default template and without caching. The download links point to /music/a.mp3 and /music/b.mp3
     musicexpo a.mp3 b.flac
 
-    # Disables caching, and the download links point to /download/a.flac, /download/b.flac, /download/c.flac
-    musicexpo --no-caching --prefix /download/ my/music/a.flac my/music/b.flac othermusic/c.flac
+    # Caches to 'cache.db', and the download links point to /download/a.flac, /download/b.flac, /download/c.flac
+    musicexpo --cache 'cache.db' --prefix /download/ my/music/a.flac my/music/b.flac othermusic/c.flac
 
     # Caches into /tmp/musicexpocache and uses directory/file.tmpl as template
     musicexpo --cache /tmp/musicexpocache --template directory/file.tmpl my-music/*.mp3
@@ -48,11 +48,7 @@ Prefix for download links. Defaults to '/music/'.
 
 =item B<--cache> I<filename>
 
-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
 
-- 
2.39.5