Acme-Free-Advice-Unsolicited

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN

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

Acme::Free::Advice::Unsolicited - Solicit Unsolicited Advice from Kevin Kelly

# SYNOPSIS

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

# DESCRIPTION

Acme::Free::Advice::Unsolicited provides wisdom from author and leading technology observer, [Kevin
Kelly](https://en.wikipedia.org/wiki/Kevin_Kelly_\(editor\)).

# METHODS

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

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


=encoding utf-8

=head1 NAME

Acme::Free::Advice::Unsolicited - Solicit Unsolicited Advice from Kevin Kelly

=head1 SYNOPSIS

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

=head1 DESCRIPTION

Acme::Free::Advice::Unsolicited provides wisdom from author and leading technology observer, L<Kevin
Kelly|https://en.wikipedia.org/wiki/Kevin_Kelly_(editor)>.

=head1 METHODS

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

script/advice_kk.pl  view on Meta::CPAN

#
my $raw = 0;
my ( $id, $all );

sub _echo ($slip) {    # JSON::Tiny is loaded in Acme::Free::Advice::Unsolicited anyway
    $raw ? JSON::Tiny::encode_json($slip) : $slip;
}
GetOptions( 'json' => \$raw, 'help' => sub { pod2usage( -exitval => 1 ) }, 'id=i' => \$id, 'all!' => \$all );
if ( defined $all ) {
    my @slips = Acme::Free::Advice::Unsolicited::all();
    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::Unsolicited::advice($id);
exit !( $slip ? say _echo($slip) : !say( $raw ? 'null' : '' ) );
__END__

=head1 NAME

advice_kk - Seek unsolicited advice from Keven Kelly in the terminal

=head1 SYNOPSIS

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



( run in 2.396 seconds using v1.01-cache-2.11-cpan-a9496e3eb41 )