File: getter.pl

package info (click to toggle)
libmastodon-client-perl 0.017-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 336 kB
  • sloc: perl: 1,525; makefile: 9
file content (34 lines) | stat: -rw-r--r-- 718 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env perl

binmode STDOUT, ':utf8';

use warnings;
use strict;
use diagnostics;

use Mastodon::Client;
use Config::Tiny;

use Log::Any::Adapter;
my $log = Log::Any::Adapter->set( 'Stderr',
  category => 'Mastodon',
  log_level => 'warn',
);

unless (scalar @ARGV) {
  print "  Missing arguments
  USAGE: $0 <CONFIG>

  <CONFIG> should be an INI file with a valid 'client_secret', 'client_id', and
  'access_token', and an 'instance' key with the URL to a Mastodon instance.\n";
  exit(1);
}

my $config = (scalar @ARGV) ? Config::Tiny->read( $ARGV[0] )->{_} : {};
my $client = Mastodon::Client->new({
  %{$config},
  coerce_entities => 0,
});

use Data::Dumper;
print Dumper($client->get( $ARGV[1] )), "\n";