Hi,

my script does not use DateTime::Locale directly. I only use DateTime. This is the script I use:

#!/usr/bin/perl
use Net::Twitter;
use Scalar::Util 'blessed';
use DateTime;
use Storable qw(retrieve nstore);
use LWP::Simple;

# Variable definitions
my $configfile = "/home/reiner/.FollowTwitterStream";
my $path = "/home/reiner/Twitter";
my $consumer_key = 'xxxxxxxxxx';
my $consumer_secret = 'xxxxxxxxxxxx';
my $token = 'xxxxxxxxxxxxxxxxxxxxxxxx';
my $token_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxx';
my $high_water = 429901897936674816;
my $dt;
my $DEBUG = 0;

# Kill script after 59 min to avoid hanging
alarm(3540);

# Read config
if (-r $configfile) {
    $dt = retrieve("$configfile");
}

# Connect to Twitter
my $twitter = Net::Twitter->new(
    traits   => [qw/API::RESTv1_1/],
    consumer_key        => $consumer_key,
    consumer_secret     => $consumer_secret,
    access_token        => $token,
    access_token_secret => $token_secret,
    ssl                 => 1,
);

eval {
    my $statuses = $twitter->home_timeline({ -since => $dt, count => 100 });
    for my $status ( @$statuses ) {
print "$status->{id} $status->{created_at} <$status->{user}{screen_name}> $status->{text}\n" if $DEBUG;
        my $medialist = $status->{entities}->{media};
        foreach my $media ( @$medialist ) {
            my $url = $media->{media_url};
            my $file = (URI->new($url)->path_segments)[-1];
            if ($url =~ /twimg\.com/ ) {
                $url .= ":large";
            }
print "Get $url as $path/$status->{user}{screen_name}$file\n" if $DEBUG;
            getstore("$url", "$path/$status->{user}{screen_name}$file");
        }
        $high_water = "$status->{id}";
    }
};
if ( my $err = $@ ) {
    die $@ unless blessed $err && $err->isa('Net::Twitter::Error');

    warn "HTTP Response Code: ", $err->code, "\n",
         "HTTP Message......: ", $err->message, "\n",
         "Twitter error.....: ", $err->error, "\n";
}

$dt = DateTime->now;
nstore $dt, "$configfile";


On Thu, 4 Jan 2018, gregor herrmann wrote:

On Thu, 04 Jan 2018 22:51:21 +0100, Reiner Buehl wrote:

after upgrading my system from Jessie to Stretch, I get the
following error messages from a perl skript that used to work fine
before the upgrade:

Can't locate DateTime/Locale/en_US.pm in @INC (you may need to install the 
DateTime::Locale::en_US module) (@INC contains: /etc/perl 
/usr/local/lib/i386-linux-gnu/perl/5.24.1 /usr/local/share/perl/5.24.1 
/usr/lib/i386-linux-gnu/perl5/5.24 /usr/share/perl5 /usr/lib/i386-linux-gnu/perl/5.24 
/usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/i386-linux-gnu/perl-base) at 
/usr/lib/i386-linux-gnu/perl/5.24/Storable.pm line 389, <DATA> line 1.
BEGIN failed--compilation aborted, <DATA> line 1, at 
/home/reiner/bin/FollowTwitterStream.pl line 24.

Could you please show us how you use DateTime::Locale in your script?


The upstream changelog shows some thing around en_US and en-US but I
can't reproduce the problem in my quick naïve try:

% perl -MDateTime::Locale -E '$locale = DateTime::Locale->load("en-US"); say 
$locale->native_name;'
English United States
% perl -MDateTime::Locale -E '$locale = DateTime::Locale->load("en_US"); say 
$locale->native_name;'
English United States


And regarding your error message about a missing
"DateTime/Locale/en_US.pm":

/usr/share/perl5/DateTime/Locale/en_US.pm has indeed existed some
versions ago, then the whole thing has been restructured; cf. the
section "0.90     2015-09-27" in
/usr/share/doc/libdatetime-locale-perl/changelog.gz.


So my suspicion is that you are using what is called the "old API" in
the upstream changelog and need to update your script.


Cheers,
gregor

--
.''`.  https://info.comodo.priv.at -- Debian Developer https://www.debian.org
: :' : OpenPGP fingerprint D1E1 316E 93A7 60A8 104D  85FA BB3A 6801 8649 AA06
`. `'  Member VIBE!AT & SPI Inc. -- Supporter Free Software Foundation Europe
  `-   NP: Sinéad O'Connor: Jealous



Gruß,
Reiner.

----------------------------------------------------------------------
Reiner Buehl                         Internet:
Karlstrasse 3                        rei...@buehl.net
70771 Leinfelden-Echterdingen
Germany
----------------------------------------------------------------------

Reply via email to