ARGV = qw[-h];
#
my $raw = 0;
sub _echo ($insult) { # JSON::Tiny is loaded in Acme::Insult::Glax anyway
$raw ? JSON::Tiny::encode_json( {%$insult} ) : $insult;
}
GetOptions( \my %h, 'who=s', '
template=s', 'plural!', 'help' => sub { pod2usage( -exitval => 1 ) }, 'json!' => \$raw, 'adjective!', 'sfw!' );
$h{lang} = 'en_corporate' if delete $h{sfw};
my $shade = delete $h{adjective} ? Acme::In
nsult -template='...' # generate insults with a specific format
glax_insult -json # insult someone if you're a robot
glax_insult -who John
# https://www.freepublicapis.com/insult-api
use v5.38;
use HTTP::Tiny;
use JSON::Tiny qw[decode_json];
use URI;
use parent 'Exporter';
our %EXPORT_TAGS = ( all => [ our @EXPOR
ers => { Accept => 'application/json' }, agent => sprintf '%s/%.2f ', __PACKAGE__, our $VERSION );
( my $hey = $api->clone )->path( '/api/' . $endpoint . '.json' );
$hey->query_form(%p
true even when advice is not found but we'll at least know when we have valid JSON
$res->{success} ? decode_json( $res->{content} ) : ();
}
#
sub insult (%args) { my $ref = _http(