summaryrefslogtreecommitdiff
path: root/tweet-archive.pl
diff options
context:
space:
mode:
authorGianni Ceccarelli <gianni.ceccarelli@broadbean.com>2023-02-22 10:51:36 +0000
committerGianni Ceccarelli <gianni.ceccarelli@broadbean.com>2023-02-22 10:51:36 +0000
commit7d942e463679220c13468f1530ebc002efcd832c (patch)
tree4d021c7725a1226927a69d0dd93f0845b50f0d3e /tweet-archive.pl
parentonly print failed responses on error (diff)
downloadtweet-archive-7d942e463679220c13468f1530ebc002efcd832c.tar.gz
tweet-archive-7d942e463679220c13468f1530ebc002efcd832c.tar.bz2
tweet-archive-7d942e463679220c13468f1530ebc002efcd832c.zip
update to 5.36
Diffstat (limited to 'tweet-archive.pl')
-rw-r--r--tweet-archive.pl25
1 files changed, 16 insertions, 9 deletions
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;