package Acme::Free::Advice 1.1 { use v5.38; use parent 'Exporter'; use Module::Load; our %EXPORT_TAGS = ( all => [ our @EXPORT_OK = qw[advice flavors] ] ); # my %flavor = ( map { my $pkg = 'Acme::Free::Advice::' . $_; ( eval 'require ' . $pkg ? ( lc($_) => $pkg ) : () ), } qw[Slip Unsolicited] ); sub advice ( $flavor //= ( keys %flavor )[ rand keys %flavor ] ) { $flavor{$flavor} // return (); my $cv = $flavor{$flavor}->can('advice'); $cv ? $cv->() : (); } sub flavors () { keys %flavor } } 1; __END__ =encoding utf-8 =head1 NAME Acme::Free::Advice - Wise words. Dumb code. =head1 SYNOPSIS use Acme::Free::Advice qw[advice]; say advice; =head1 DESCRIPTION Acme::Free::Advice spits out advice. Good advice. Bad advice. Advice. It's a fortune cookie. =head1 METHODS These functions may be imported by name or with the C<:all> tag. =head2 C Tear someone down. my $wisdom = advice( ); # Random advice print advice( ); # stringify print advice( 'slip' ); Expected parameters include: =over =item C If undefined, a random supported flavor is used. Currently, supported flavors include: =over =item C Uses L =item C Uses L =back =back =head2 C my @flavors = flavors( ); Returns a list of supported advice flavors. =head1 LICENSE Copyright (C) Sanko Robinson. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 AUTHOR Sanko Robinson Esanko@cpan.orgE =head2 ...but why? I'm inflicting this upon the world because L invited me to help expand Perl's coverage of smaller open APIs. Blame them or L in the effort. =cut