| 1 | package Acme::Scurvy::Whoreson::BilgeRat::Backend::lala; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | $VERSION = '1.0'; | |||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | ▶ | use base 'Acme::Scurvy::Whoreson::BilgeRat'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | =head1 NAME | ||||||||||
| 11 | |||||||||||
| 12 | Acme::Scurvy::Whoreson::BilgeRat::Backend::lala - generate insults in the style of one of London.pm's bots | ||||||||||
| 13 | |||||||||||
| 14 | =head1 SYNOPSIS | ||||||||||
| 15 | |||||||||||
| 16 | use Acme::Scurvy::Whoreson::BilgeRat; | ||||||||||
| 17 | |||||||||||
| 18 | my $insultgenerator = Acme::Scurvy::Whoreson::BilgeRat->new( | ||||||||||
| 19 | language => 'lala' | ||||||||||
| 20 | ); | ||||||||||
| 21 | |||||||||||
| 22 | print $insultgenerator; # prints a piratical insult | ||||||||||
| 23 | |||||||||||
| 24 | |||||||||||
| 25 | =head1 DESCRIPTION | ||||||||||
| 26 | |||||||||||
| 27 | The IRC channel #london.pm on the rhizomatic network used to have a bot, | ||||||||||
| 28 | called Lala, that would insult you in her own inimitable style. | ||||||||||
| 29 | |||||||||||
| 30 | This is a backed for C<Acme::Scurvy::Whoreson::BilgeRat> that reproduces that style. | ||||||||||
| 31 | |||||||||||
| 32 | It's useless to anyone but this one particular project I'm working on. | ||||||||||
| 33 | But since when has that stopped me? | ||||||||||
| 34 | |||||||||||
| 35 | =head1 AUTHOR | ||||||||||
| 36 | |||||||||||
| 37 | Simon Wistow <simon@thegestalt.org> | ||||||||||
| 38 | |||||||||||
| 39 | based on code by | ||||||||||
| 40 | |||||||||||
| 41 | Jonathan Stowe <jns@gellyfish.com> | ||||||||||
| 42 | |||||||||||
| 43 | =head1 COPYRIGHT | ||||||||||
| 44 | |||||||||||
| 45 | Copyright 2005, Simon Wistow | ||||||||||
| 46 | |||||||||||
| 47 | Distributed under the same terms as Perl itself. | ||||||||||
| 48 | |||||||||||
| 49 | =head1 SEE ALSO | ||||||||||
| 50 | |||||||||||
| 51 | http://london.pm.org | ||||||||||
| 52 | |||||||||||
| 53 | =cut | ||||||||||
| 54 | |||||||||||
| 55 | |||||||||||
| 56 | |||||||||||
| 57 | 1 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 58 | 1 | my $class = shift; | |||||||||
| 59 | |||||||||||
| 60 | 1 | my (@noun, @adj1, @adj2); | |||||||||
| 61 | |||||||||||
| 62 | 1 | my $pos = tell DATA; | |||||||||
| 63 | 1 | ▶ | while(<DATA>) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 64 | 49 | chomp; | |||||||||
| 65 | 49 | ▶ | next if /^\s*$/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 66 | |||||||||||
| 67 | |||||||||||
| 68 | 49 | my ($adj1,$adj2,$noun) = split; | |||||||||
| 69 | |||||||||||
| 70 | 49 | push @adj1, $adj1; | |||||||||
| 71 | 49 | push @adj2, $adj2; | |||||||||
| 72 | 49 | push @noun, $noun; | |||||||||
| 73 | } | ||||||||||
| 74 | |||||||||||
| 75 | 1 | seek DATA, $pos,0; | |||||||||
| 76 | |||||||||||
| 77 | |||||||||||
| 78 | 1 | return bless { noun => \@noun, adj1 => \@adj1, adj2 => \@adj2 }, $class; | |||||||||
| 79 | } | ||||||||||
| 80 | |||||||||||
| 81 | 3 | ▶ | sub generateinsult { | ||||||||
|
Subroutine
generateinsult: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 82 | 3 | my $self =shift; | |||||||||
| 83 | 3 | my @adj1 = @{$self->{adj1}}; | |||||||||
| 84 | 3 | my @adj2 = @{$self->{adj2}}; | |||||||||
| 85 | 3 | my @noun = @{$self->{noun}}; | |||||||||
| 86 | |||||||||||
| 87 | 3 | return $adj1[rand @adj1] . " "; | |||||||||
| 88 | 0 | $adj2[rand @adj2] . " " . | |||||||||
| 89 | $noun[ rand @noun]; | ||||||||||
| 90 | } | ||||||||||
| 91 | 1 | 1; | |||||||||
| 92 | __DATA__ | ||||||||||