Acme-Free-Advice-Slip

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

[![Actions Status](https://github.com/sanko/Acme-Free-Advice-Slip/actions/workflows/ci.yml/badge.svg)](https://github.com/sanko/Acme-Free-Advice-Slip/actions) [![MetaCPAN Release](https://badge.fury.io/pl/Acme-Free-Advice-Slip.svg)](https://metacpan....
# NAME

Acme::Free::Advice::Slip - Seek Advice from the Advice Slip API

# SYNOPSIS

```perl
use Acme::Free::Advice::Slip qw[advice];
say advice( 224 )->{advice};
```

# DESCRIPTION

Acme::Free::Advice::Slip provides wisdom from [AdviceSlip.com](https://adviceslip.com/).

# METHODS

These functions may be imported by name or with the `:all` tag.

lib/Acme/Free/Advice/Slip.pm  view on Meta::CPAN


=encoding utf-8

=head1 NAME

Acme::Free::Advice::Slip - Seek Advice from the Advice Slip API

=head1 SYNOPSIS

    use Acme::Free::Advice::Slip qw[advice];
    say advice( 224 )->{advice};

=head1 DESCRIPTION

Acme::Free::Advice::Slip provides wisdom from L<AdviceSlip.com|https://adviceslip.com/>.

=head1 METHODS

These functions may be imported by name or with the C<:all> tag.

=head2 C<advice( [...] )>

script/advice_slip.pl  view on Meta::CPAN

            map {
                {%$_}
            } @$slip
        ]
        ) :
        $slip;
}
GetOptions( 'json' => \$raw, 'help' => sub { pod2usage( -exitval => 1 ) }, 'id=i' => \$id, 'search=s' => \$query );
if ( defined $query ) {
    my @slips = Acme::Free::Advice::Slip::search($query);
    exit say $raw ? '[]' : 'No advice matches query' unless +@slips;
    exit !say _echo( \@slips ) if $raw;
    say _echo($_) for @slips;
    exit !@slips;
}
my $slip = Acme::Free::Advice::Slip::advice($id);
exit !( $slip ? say _echo($slip) : !say( $raw ? 'null' : '' ) );
__END__

=head1 NAME

advice_slip - Seek wisdom in the terminal

=head1 SYNOPSIS

    advice_slip                     # gather random wisdom
    advice_slip -id 5               # specific advice by ID



( run in 0.957 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )