about summary refs log tree commit diff stats
path: root/ara.pl
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2020-06-06 14:23:16 +0530
committerAndinus <andinus@nand.sh>2020-06-06 14:23:16 +0530
commitf6be7b4f01409b107afdf9d61942b5db7db42ecb (patch)
tree8d88f156c58a8fec8a5121deae785118c822515d /ara.pl
parent50ca176c7ebba69ee5268de7feaa1799f4672a44 (diff)
downloadara-f6be7b4f01409b107afdf9d61942b5db7db42ecb.tar.gz
use File::Fetch only when required
'use File::Fetch' gets processed at compile time so we use 'require
File::Fetch' instead.
Diffstat (limited to 'ara.pl')
-rwxr-xr-xara.pl3
1 files changed, 2 insertions, 1 deletions
diff --git a/ara.pl b/ara.pl
index b115764..fec9c3d 100755
--- a/ara.pl
+++ b/ara.pl
@@ -6,7 +6,6 @@ use feature 'say';
 
 use DateTime qw( );
 use Path::Tiny;
-use File::Fetch;
 use JSON::MaybeXS qw( decode_json );
 use Text::Table::Tiny qw( generate_table );
 use Text::ASCIITable;
@@ -52,6 +51,8 @@ if ( -e $file ) {
 if ( ( not -e $file ) or
      ( $file_mtime <
        DateTime->now( time_zone => 'Asia/Kolkata' )->subtract( minutes => 8 ) ) ) {
+    require File::Fetch;
+
     # Fetch latest data from api.
     my $url = 'https://api.covid19india.org/data.json';
     my $ff = File::Fetch->new(uri => $url);