about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xara.pl15
1 files changed, 9 insertions, 6 deletions
diff --git a/ara.pl b/ara.pl
index 3f59efa..7836f6f 100755
--- a/ara.pl
+++ b/ara.pl
@@ -100,20 +100,23 @@ foreach my $path ( sort keys %unveil ) {
 my $file = "$cache_dir/ara.json";
 my $file_mtime;
 
-# If $file exists then get ctime.
+# If $file exists then get mtime.
 if ( -e $file ) {
     my $file_stat = path($file)->stat;
     $file_mtime = Time::Moment->from_epoch( $file_stat->mtime );
 } else {
-    warn "File '$file' doesn't exist\nFetching latest...\n"
-        if $use_local_file;
+    if ( $use_local_file ) {
+        warn "File '$file' doesn't exist\nFetching latest...\n";
+        undef $use_local_file;
+    }
 }
 
 # Fetch latest data only if the local data is older than 8 minutes or
 # if the file doesn't exist.
-if ( not -e $file
-         or $file_mtime < Time::Moment->now_utc->minus_minutes(8)
-         or $get_latest ) {
+if ( not $use_local_file
+         and ( not -e $file
+               or $file_mtime < Time::Moment->now_utc->minus_minutes(8)
+               or $get_latest ) ) {
     require HTTP::Simple;
 
     no warnings 'once';