|
Acme::Scurvy::Whoreson::BilgeRat - multi-lingual insult generator |
Acme::Scurvy::Whoreson::BilgeRat - multi-lingual insult generator
use Acme::Scurvy::Whoreson::BilgeRat;
my $insultgenerator = Acme::Scurvy::Whoreson::BilgeRat->new(
language => 'pirate'
);
print $insultgenerator; # prints a piratical insult
A multi-lingual insult generator, which takes pluggable backends to generate insults in the language of your choice, written in honour of International Talk Like A Pirate Day on Sept 19th 2003 http://www.talklikeapirate.com/. An example backend is provided which implements the 'pirate' language.
Usage is very simple. Instantiate an Acme::Scurvy::Whoreson::BilgeRat object, passing a single named parameter - 'language' - to the constructor. This tells it to use the A::S::W::B::Backend::[language] plugin module. If that is missing, we assume you want the 'pirate' backend.
To generate an insult, simply mention your object in any place where it will be turned into a string. It uses the AWESOME POWER of operator overloading to achieve this heroic feat.
So, on to the most complex part of all this, which thankfully isn't that complex.
To create a plugin, you create a bog-standard module, whose name is Acme::Scurvy::Whoreson::BilgeRat::Backend::[your language name]. It should be a subclass of A::S::W::B. The constructor should return a blessed object and must be called new(). You then have two options:
new() return
a blessed hashref with the following keys:
You may have words appearing in both the nouns and the adjectives lists. The default insult generator will ensure that it never uses the same word twice in any one insult. Of course, there are some situations where there are simply not enough nouns or adjectives in the grammar, in which case an empty insult is generated.
You may have words appearing in both the nouns and the adjectives lists.
The default insult generator will ensure that it never uses the same word
twice in any one T> Us to dly isn'eard
ives
clDD>
>
dardr::W
item_e is csmarpartrely
upando>
>
o :Whod IG>