| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package App::Toot; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
3741
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
29
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
25
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
403
|
use App::Toot::Config; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
31
|
|
|
7
|
1
|
|
|
1
|
|
612
|
use Mastodon::Client; |
|
|
1
|
|
|
|
|
1110620
|
|
|
|
1
|
|
|
|
|
260
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
|
12
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
|
13
|
0
|
|
|
|
|
|
my $arg = shift; |
|
14
|
|
|
|
|
|
|
|
|
15
|
0
|
0
|
|
|
|
|
if ( !defined $arg->{'config'} ) { |
|
16
|
0
|
|
|
|
|
|
die 'config is required'; |
|
17
|
|
|
|
|
|
|
} |
|
18
|
|
|
|
|
|
|
|
|
19
|
0
|
0
|
|
|
|
|
if ( !defined $arg->{'status'} ) { |
|
20
|
0
|
|
|
|
|
|
die 'status is required'; |
|
21
|
|
|
|
|
|
|
} |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $self = { |
|
24
|
|
|
|
|
|
|
config => App::Toot::Config->load( $arg->{'config'} ), |
|
25
|
0
|
|
|
|
|
|
status => $arg->{'status'}, |
|
26
|
|
|
|
|
|
|
}; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$self->{'client'} = Mastodon::Client->new( |
|
29
|
|
|
|
|
|
|
instance => $self->{'config'}{'instance'}, |
|
30
|
|
|
|
|
|
|
name => $self->{'config'}{'username'}, |
|
31
|
|
|
|
|
|
|
client_id => $self->{'config'}{'client_id'}, |
|
32
|
|
|
|
|
|
|
client_secret => $self->{'config'}{'client_secret'}, |
|
33
|
0
|
|
|
|
|
|
access_token => $self->{'config'}{'access_token'}, |
|
34
|
|
|
|
|
|
|
coerce_entities => 1, |
|
35
|
|
|
|
|
|
|
); |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
return bless $self, $class; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub run { |
|
41
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
42
|
|
|
|
|
|
|
|
|
43
|
0
|
|
|
|
|
|
return $self->{'client'}->post_status( $self->{'status'} ); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=pod |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 NAME |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
App::Toot - post a status to Mastodon |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
use App::Toot; |
|
59
|
|
|
|
|
|
|
my $app = App::Toot->new({ config => 'default', status => 'toot all day' }); |
|
60
|
|
|
|
|
|
|
my $ret = $app->run(); |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
C<App::Toot> is a program to post statues to Mastodon. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
For the commandline tool, see the documentation for L<toot> or C<man toot>. |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 INSTALLATION |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
perl Makefile.PL |
|
71
|
|
|
|
|
|
|
make && make test && make install |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 METHODS |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head2 new |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Class constructor for the C<App::Toot> object. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Loads and sets the C<config> and C<status> keys into the object. |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head3 ARGUMENTS |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
The arguments for the C<new> method must be passed as a hashref containing the following keys: |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=over |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item config |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
String value of the config section to load. |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Required. |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item status |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
String value of the status to post. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Required. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=back |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head3 RETURNS |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Returns an C<App::Toot> object. |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head2 run |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Posts the status to Mastodon. |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head3 ARGUMENTS |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
None. |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head3 RETURNS |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Returns a L<Mastodon::Entity::Status> object. |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 CONFIGURATION |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
For configuration, see the documentation for L<App::Toot::Config> or C<perldoc App::Toot::Config>. |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Copyright (c) 2023 Blaine Motsinger under the MIT license. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 AUTHOR |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Blaine Motsinger C<blaine@renderorange.com> |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=cut |