Animal::Horse->moniker # horse Animal::Black_Sheep->moniker # blacksheep
That's useful for programming, but I'd like to be able to print out the names as more friendly labels. So I'd like
Animal::Horse # Horse Animal::Black_Sheep # Black Sheep
Nothing fancy, but there doesn't seem to be anything quite doing this on CPAN (or am I wrong?).
I'm calling this Text::Printable for the moment, but that might be too generic.
=head1 SYNOPSIS
use Text::Printable;
print printable( 'Foo::Bar::Very_ugly_name' ); # Very Ugly Name
print plural_printable( 'Foo::Bar::Very_ugly_name' ); # Very Ugly Names
use Text::Printable UNIVERSAL => 1;
print Foo::Bar::Very_ugly_name->printable; # Very Ugly Name
print Foo::Bar::Very_ugly_name->plural_printable; # Very Ugly Names
print printable( 'Some_other_ugliness' ); # dies - function not exported by default with UNIVERSAL option
use Text::Printable export => 1, UNIVERSAL => 1;
print printable( 'Some_other_ugliness' ); # Some Other Ugliness
=head2 printable( [ { %opts } ], [ $unprintable ] )
printable( { %opts }, $unprintable );
$ob->printable; $ob->printable( { ucfirst => 0 } ); $ob->printable( 'Convert_this_instead' );
Returns the printable moniker for $ob. So, if $ob->isa("Big::Scary::Animal"), C<printable> will return "Animal". And if $ob->isa("Big::Scary::Ugly_animal"), C<printable> will return "Ugly Animal".
Options:
name default effect ---------------------------------------- ucfirst 1 ucfirst every word all_caps 0 ALL CAPS nbsp 0 convert spaces to
=cut