App::Toot - post a status to Mastodon
use App::Toot;
my $app = App::Toot->new({ config => 'name', status => 'status to post' });
my $ret = $app->run();
# the commandline tool
toot [--config <name>] [--status <status to post>] [--help]
App::Toot is a program to post statues to Mastodon.
For the commandline tool, please see the documentation for toot or man toot.
perl Makefile.PL
make && make test && make install
To post to Mastodon, you need to provide the account's oauth credentials in the file config.ini.
An example is provided as part of this distribution. The user running the toot script, for example through cron, will need access to the configuration file.
To set up the configuration file, copy config.ini.example into one of the following locations:
$ENV{HOME}/.config/toot/config.ini/etc/toot/config.ini
After creating the file, edit and update the values in the default section to match the account's oauth credentials.
[default]
instance = mastodon.social
username = youruser
client_id = OKE98_kdno_NOTAREALCLIENTID
client_secret = mkjklnv_NOTAREALCLIENTSECRET
access_token = jo83_NOTAREALACCESSTOKEN
NOTE: If the $ENV{HOME}/.config/toot/ directory exists, config.ini will be loaded from there regardless of a config file in /etc/toot/.
The following keys are required for each section:
-
instance
The Mastodon server name the account belongs to.
-
username
The account name for the Mastodon server defined in
instance. -
client_id
The
client_idas provided for theusernameon theinstance. -
client_secret
The
client_secretas provided for theusernameon theinstance. -
access_token
The
access_tokenas provided for theusernameon theinstance.
Multiple accounts can be configured with different sections after the default section.
[default]
instance = mastodon.social
username = youruser
client_id = OKE98_kdno_NOTAREALCLIENTID
client_secret = mkjklnv_NOTAREALCLIENTSECRET
access_token = jo83_NOTAREALACCESSTOKEN
[development]
instance = botsin.space
username = youruserdeveluser
client_id = Ijjkn_STILLNOTAREALCLIENTID
client_secret = u7hhd_STILLNOTAREALCLIENTSECRET
access_token = D873_SKILLNOTAREALACCESSTOKEN
The section name, development in the example above, can be named anything as long as it's unique with the other section names.
To post to the other account, define the config value for that account.
# within code
my $app = App::Toot->new({ config => 'development', status => 'status to post' });
# the commandline tool
toot [--config <development>] [--status <status to post>] [--help]
Copyright (c) 2023 Blaine Motsinger under the MIT license.
Blaine Motsinger [email protected]