package Net::Twitter::Loader;
use strict;
use warnings;
use JSON qw(decode_json encode_json);
use Try::Tiny;
use Carp;
use Time::HiRes qw(sleep);
our $VERSION = "0.04";
our @CARP_NOT = qw(Try::Tiny
$self->{filepath} or return undef;
my $json_text = do { local $/ = undef; <$file> };
close $file;
my $since_ids = try {
decode_json($json_text);
}catch {
my $e = shift;
$self->_log("warn", "failed to decode_json");
return {};
};
$since_ids = {} if not defined $since_ids;
return $since_ids;
}
sub _log {
my ($self, $level, $msg) = @_;