May 26, 2018

Moniker for classes

Class names in Perl often don’t sound great when spoken, or look good when written in prose. For this reason, we tend to say things like “customer” or “basket” when we are referring to MySiteUserCustomer or MySiteShopBasket. We thought it would be nice if our classes knew what we would prefer to call them.

This module will add a moniker and plural_moniker method to UNIVERSAL, and so to every class or module.

So, if $ob->isa”BigScaryAnimal”, moniker will return “animal”; $ob->isa”CephalopodOctopus”, plural_moniker will return “octopuses”.

WWW http//