Acme-Free-API-ChuckNorris
view release on metacpan or search on metacpan
use warnings;
use Dispatch::Fu;
use Acme::Free::API::ChuckNorris qw//;
use Util::H2O::More qw/Getopt2h2o o2d/;
my $subcommand = shift @ARGV;
#>>>
dispatch {
xdefault shift, q{random};
} $subcommand,
random => sub { do_random(\@ARGV) },
categories => \&do_categories,
search => sub { do_search(@ARGV) },
help => \&do_help,
;
#<<<
sub do_categories {
my ($ARGV) = @_;
lib/Acme/Free/API/ChuckNorris.pm view on Meta::CPAN
travel
The first line is output via C<STDERR>, so you don't have to filter it out
if you wanted to do something wacky, like printing out 1 random quote for
each currently supported category:
shell>cnq categories | xargs -I% cnq random --category %
=item C<random [--category STRING]>
The command that returns the random Chuch Noris quote. It is the default
command if none is specified:
shell> cnq random
Chuck Norris dunks onion rings in his morning coffee.
shell> nq random
Chuck Norris savors the sweet taste of ax-murder.
shell> cnq random
Chuck Norris puts the "hurt" in yoghurt.
shell> cnq
Chuck Norris' leg kicks hit hard enough to knock the polio vaccine out of your body
( run in 1.024 second using v1.01-cache-2.11-cpan-0a6323c29d9 )