Disable caching by default, remove --caching argument
authorMarius Gavrilescu <Marius Gavrilescu>
Sat, 17 Aug 2013 21:18:01 +0000 (00:18 +0300)
committerMarius Gavrilescu <Marius Gavrilescu>
Sat, 17 Aug 2013 21:18:01 +0000 (00:18 +0300)
lib/App/MusicExpo.pm
musicexpo

index 475ef80f971dba4595ef3975a2637f997e9d531d..42526fa749045cc5c48326874770c78427e7ca38 100644 (file)
@@ -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
 
index 476842433b9991559dab8c20b508b34cf4dde033..8e7ea016bd054fd897197aaa44b22e162d6d215d 100755 (executable)
--- 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
 
This page took 0.013399 seconds and 4 git commands to generate.