Acme-Insult-Pirate

 view release on metacpan or  search on metacpan

lib/Acme/Insult/Pirate.pm  view on Meta::CPAN

package Acme::Insult::Pirate 1.1 {
    use v5.38;
    use HTTP::Tiny;

    #~ use JSON::Tiny qw[decode_json]; # Not needed here (yet)
    use URI;
    use parent 'Exporter';
    our %EXPORT_TAGS = ( all => [ our @EXPORT_OK = qw[insult] ] );
    #
    use overload '""' => sub ( $s, $u, $b ) { $s->{insult} // () };
    #
    sub _http (%params) {
        state $http
            //= HTTP::Tiny->new( default_headers => { Accept => 'application/json' }, agent => sprintf '%s/%.2f ', __PACKAGE__, our $VERSION );
        state $api //= URI->new('https://pirate.monkeyness.com/api/insult');

        #~ $api->query_form( %params );



( run in 1.160 second using v1.01-cache-2.11-cpan-4d50c553e7e )