Acme-Scurvy-Whoreson-BilgeRat-Backend-insultserver
view release on metacpan or search on metacpan
lib/Acme/Scurvy/Whoreson/BilgeRat/Backend/insultserver.pm view on Meta::CPAN
http://insulthost.colorado.edu/
=cut
sub new {
my $class = shift;
my $self = {};
my $pos = tell DATA;
while(<DATA>) {
chomp;
next if /^\s*$/;
next if /^\s*#/;
next unless s!^\s*(adj|amt|noun)\s+!!i;
my $what = $1;
# turn the '|' character into a space
push @{$self->{$what}}, map { s!\|! !g; $_ } split ' ', $_;
}
seek DATA, $pos,0;
return bless $self, $class;
}
sub generateinsult {
my $self =shift;
my @adj = @{$self->{adj}};
my @noun = @{$self->{noun}};
lib/Acme/Scurvy/Whoreson/BilgeRat/Backend/insultserver.pm view on Meta::CPAN
my $return = "You are nothing but a";
$return .= 'n' if substr($adj1,0,1) =~ m![aeiou]!;
$return .= sprintf(" %s %s of %s %s.", $adj1, $amt, $adj2, $noun);
return $return;
}
1;
__DATA__
#
# configuration file for colorado insult server
#
# Use the '|' character to include a space in the middle of a noun, adjective
# or amount (it'll get transmogrified into a space. No, really!).
#
# Mon Mar 16 10:49:53 MST 1992 garnett added more colorful insults
# Fri Dec 6 10:48:43 MST 1991 garnett
#
lib/Acme/Scurvy/Whoreson/BilgeRat/Backend/lala.pm view on Meta::CPAN
=cut
sub new {
my $class = shift;
my (@noun, @adj1, @adj2);
my $pos = tell DATA;
while(<DATA>) {
chomp;
next if /^\s*$/;
my ($adj1,$adj2,$noun) = split;
push @adj1, $adj1;
push @adj2, $adj2;
push @noun, $noun;
}
seek DATA, $pos,0;
return bless { noun => \@noun, adj1 => \@adj1, adj2 => \@adj2 }, $class;
}
sub generateinsult {
my $self =shift;
my @adj1 = @{$self->{adj1}};
my @adj2 = @{$self->{adj2}};
my @noun = @{$self->{noun}};
return $adj1[rand @adj1] . " ";
$adj2[rand @adj2] . " " .
$noun[ rand @noun];
}
1;
__DATA__
artless base-court apple-john
bawdy bat-fowling baggage
beslubbering beef-witted barnacle
bootless beetle-headed bladder
churlish boil-brained boar-pig
cockered clapper-clawed bugbear
clouted clay-brained bum-bailey
craven common-kissing canker-blossom
currish crook-pated clack-dish
dankish dismal-dreaming clotpole
( run in 3.270 seconds using v1.01-cache-2.11-cpan-140bd7fdf52 )