File: app-auth.pl

package info (click to toggle)
libtwitter-api-perl 1.0006-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 424 kB
  • sloc: perl: 2,868; makefile: 7
file content (22 lines) | stat: -rwxr-xr-x 495 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env perl
use 5.14.1;
use warnings;
use utf8;
use open qw/:std :utf8/;

use Twitter::API;

my $client = Twitter::API->new_with_traits(
    traits => [ qw/AppAuth ApiMethods/ ],
    consumer_key    => $ENV{CONSUMER_KEY},
    consumer_secret => $ENV{CONSUMER_SECRET},
);

my $token = $client->oauth2_token;
$client->access_token($token);
my $r = $client->user_timeline(twitterapi => { count => 10 });

for my $status ( @$r ) {
    say "$status->{user}{screen_name}: $status->{text}";
}