line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::Scurvy::Whoreson::BilgeRat::Backend::insultserver; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION = '1.0'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
900
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
43
|
|
6
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
35
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
14
|
use base 'Acme::Scurvy::Whoreson::BilgeRat'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
646
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 NAME |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Acme::Scurvy::Whoreson::BilgeRat::Backend::insultserver - generate insults in the style of the old colarado.edu Insult Server |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 SYNOPSIS |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
use Acme::Scurvy::Whoreson::BilgeRat; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $insultgenerator = Acme::Scurvy::Whoreson::BilgeRat->new( |
20
|
|
|
|
|
|
|
language => 'insultserver' |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
print $insultgenerator; # prints an insult |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
We used to have the Insult Server at http://insulthost.colorado.edu |
29
|
|
|
|
|
|
|
which you could telnet to on port 1695 to get a random insult. And Lo! |
30
|
|
|
|
|
|
|
it was fun. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Useless, but fun. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
Sadly, it's down now. This is a reimplementation in Perl. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head1 BUGS |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Should be able to specify another config file, possibly though environment variables. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head1 AUTHOR |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
Simon Wistow |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
based on code by |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
James Garnett |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 COPYRIGHT |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Copyright 2005, Simon Wistow |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Distributed under the same terms as Perl itself. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 SEE ALSO |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
http://insulthost.colorado.edu/ |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub new { |
62
|
1
|
|
|
1
|
0
|
897
|
my $class = shift; |
63
|
|
|
|
|
|
|
|
64
|
1
|
|
|
|
|
3
|
my $self = {}; |
65
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
2
|
my $pos = tell DATA; |
67
|
1
|
|
|
|
|
6
|
while() { |
68
|
53
|
|
|
|
|
57
|
chomp; |
69
|
53
|
100
|
|
|
|
152
|
next if /^\s*$/; |
70
|
49
|
100
|
|
|
|
130
|
next if /^\s*#/; |
71
|
31
|
50
|
|
|
|
131
|
next unless s!^\s*(adj|amt|noun)\s+!!i; |
72
|
31
|
|
|
|
|
48
|
my $what = $1; |
73
|
|
|
|
|
|
|
# turn the '|' character into a space |
74
|
31
|
|
|
|
|
31
|
push @{$self->{$what}}, map { s!\|! !g; $_ } split ' ', $_; |
|
31
|
|
|
|
|
100
|
|
|
188
|
|
|
|
|
200
|
|
|
188
|
|
|
|
|
323
|
|
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
6
|
seek DATA, $pos,0; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
|
|
5
|
return bless $self, $class; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub generateinsult { |
84
|
3
|
|
|
3
|
0
|
99
|
my $self =shift; |
85
|
|
|
|
|
|
|
|
86
|
3
|
|
|
|
|
5
|
my @adj = @{$self->{adj}}; |
|
3
|
|
|
|
|
50
|
|
87
|
3
|
|
|
|
|
3
|
my @noun = @{$self->{noun}}; |
|
3
|
|
|
|
|
17
|
|
88
|
3
|
|
|
|
|
5
|
my @amt = @{$self->{amt}}; |
|
3
|
|
|
|
|
17
|
|
89
|
|
|
|
|
|
|
|
90
|
3
|
|
|
|
|
5
|
my $adj1 = rand @{$self->{adj}}; |
|
3
|
|
|
|
|
41
|
|
91
|
3
|
|
|
|
|
4
|
my $adj2 = $adj1; |
92
|
3
|
|
|
|
|
3
|
do { $adj2 = rand @{$self->{adj}} } while ($adj1 == $adj2); |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
11
|
|
93
|
|
|
|
|
|
|
|
94
|
3
|
|
|
|
|
4
|
$adj1 = $adj[$adj1]; |
95
|
3
|
|
|
|
|
4
|
$adj2 = $adj[$adj2]; |
96
|
|
|
|
|
|
|
|
97
|
3
|
|
|
|
|
4
|
my $amt = $amt[rand @amt]; |
98
|
3
|
|
|
|
|
6
|
my $noun = $noun[rand @noun]; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
101
|
3
|
|
|
|
|
3
|
my $return = "You are nothing but a"; |
102
|
3
|
100
|
|
|
|
15
|
$return .= 'n' if substr($adj1,0,1) =~ m![aeiou]!; |
103
|
3
|
|
|
|
|
10
|
$return .= sprintf(" %s %s of %s %s.", $adj1, $amt, $adj2, $noun); |
104
|
|
|
|
|
|
|
|
105
|
3
|
|
|
|
|
38
|
return $return; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
1; |
109
|
|
|
|
|
|
|
__DATA__ |