From 7d942e463679220c13468f1530ebc002efcd832c Mon Sep 17 00:00:00 2001 From: Gianni Ceccarelli Date: Wed, 22 Feb 2023 10:51:36 +0000 Subject: update to 5.36 --- tweet-archive.pl | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'tweet-archive.pl') diff --git a/tweet-archive.pl b/tweet-archive.pl index 6e007d3..a1b5fff 100644 --- a/tweet-archive.pl +++ b/tweet-archive.pl @@ -1,8 +1,9 @@ #!/usr/bin/env perl -use 5.024; +use v5.36; use strict; use warnings; -use Path::Class; +use experimental 'try'; +use Path::Tiny; use JSON::MaybeXS; use Dakkar::TweetArchive; use Dakkar::TweetArchive::Store; @@ -13,10 +14,15 @@ my $json_parser = JSON::MaybeXS->new( ); my $conf = $json_parser->decode( - file(__FILE__)->parent->file('tweet-archive.conf') - ->slurp(iomode=>'<:raw') - // '{}' - ); + do { + try { + path(__FILE__)->sibling('tweet-archive.conf')->slurp_raw() + } + catch ($e) { + '{}' + } + }, +); my $client = Dakkar::TweetArchive->new($conf); my $store = Dakkar::TweetArchive::Store->new($conf); @@ -25,7 +31,7 @@ my $ua = $client->client->ua; my @responses; $ua->add_handler( response_done => sub { push @responses, $_[0]; return } ); -eval { +try { my $latest_id = $store->latest_tweet_id; for my $tweet ($client->home_timeline($latest_id)->@*) { @@ -35,8 +41,9 @@ eval { $store->store_friends($client->friends); $store->store_followers($client->followers); 1; -} or do { - print "Fail: $@\n"; +} +catch ($e) { + print "Fail: $e\n"; for my $res (@responses) { next if $res->is_success; print $res->request->as_string; -- cgit v1.2.3