From 4718404b50f480d903890242bbfee6c1715c4aa6 Mon Sep 17 00:00:00 2001 From: Hauke D Date: Wed, 19 Sep 2018 11:22:23 +0300 Subject: [PATCH] Added "debug" option to cache.pl --- cache.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cache.pl b/cache.pl index 4c5a337..d3bb8a5 100755 --- a/cache.pl +++ b/cache.pl @@ -15,6 +15,9 @@ require File::Spec::Unix; my $USE_WGET; BEGIN { $USE_WGET=0 } use if !$USE_WGET, 'HTTP::Tiny'; +my $DEBUG; BEGIN { $DEBUG=0 } +use if $DEBUG, 'Data::Dump'; + my $CACHEDIR = catdir($FindBin::Bin,'web','cache'); make_path $CACHEDIR; @@ -71,7 +74,7 @@ sub fetch_resource { else { print STDERR "already fetched\n"; } my (undef,$path) = fileparse($file); my $newurl = File::Spec::Unix->catdir(splitdir( abs2rel($cachefn,$path) )); - use Data::Dump; dd $file, $url, $cachefn, $newurl; + $DEBUG and dd($file, $url, $cachefn, $newurl); return $newurl; }