b5b6bbbb |
1 | #!/usr/bin/perl -w |
2 | # |
3 | # kenny.pl -- translate from and to KennySpeak |
4 | # |
5 | # $Revision: 1.7 $ |
6 | # |
7 | # Licensed unter the Artistic License: |
8 | # http://www.perl.com/language/misc/Artistic.html |
9 | # |
10 | # (C) 2001,2002 by Christian Garbs <mitch@cgarbs.de>, http://www.cgarbs.de |
11 | # Alan Eldridge <alane@geeksrus.net> |
12 | # |
13 | # KennySpeak invented by Kohan Ikin <syneryder@namesuppressed.com> |
14 | # http://www.namesuppressed.com/kenny/ |
15 | |
16 | # |
17 | # $Id: kenny.pl,v 1.7 2002/01/06 22:09:52 mitch Exp $ |
18 | # |
19 | |
20 | use strict; |
21 | |
22 | # |
23 | # This is Perl POD documentation. |
24 | # You can generate a nice manpage with "pod2man kenny.pl > kenny.man". |
25 | # Or have a look at "perldoc perlpod" for other options |
26 | # |
27 | |
28 | =head1 NAME |
29 | |
30 | kenny.pl -- translate from and to KennySpeak |
31 | |
32 | =head1 SYNOPSIS |
33 | |
34 | B<kenny.pl> |
35 | S<[ B<-h> ]> |
36 | S<[ B<-u> ]> |
37 | S<[ B<-k> | B<-d> ]> |
38 | S<[ I<file1> ] [ I<file2> ] ...> |
39 | |
40 | =head1 OVERVIEW |
41 | |
42 | kenny.pl translates a given text from or to B<KennySpeak>. KennySpeak |
43 | looks like this: |
44 | |
45 | "Ppfmfp ppmffm mfmppfmpm, fmpmfpmppffm'fpmmpp |
46 | pmpmffpmfpmfmppmpm Pmpmppppppppffm!" |
47 | |
48 | =head1 DESCRIPTION |
49 | |
50 | kenny.pl will read the given filenames, translate them and print the |
51 | results on stdout. If you don't give a filename, stdin is used. A F<-> |
52 | as a filename means stdin. |
53 | |
54 | Without any parameters, kenny.pl will look at the first line of input |
55 | and guess which way you want to translate. If kenny.pl guesses wrong, |
56 | you must select the translation mode using the B<-k> or B<-d> switch. |
57 | |
58 | =head2 Switches |
59 | |
60 | =over 5 |
61 | |
62 | =item B<-h> |
63 | |
64 | This will print a short notice and a quick summary of the available |
65 | switches. |
66 | |
67 | =item B<-u> |
68 | |
69 | This will convert German umlauts to Ae, Oe, Ue, ae, oe, ue and ss |
70 | so that they can be kennyfied correctly. |
71 | |
72 | =item B<-k> |
73 | |
74 | Kennyfy. This forces the input to be translated into KennySpeak. |
75 | |
76 | =item B<-d> |
77 | |
78 | Dekennyfy. This forces the input to be translated back from |
79 | KennySpeak. |
80 | |
81 | =back |
82 | |
83 | =head1 VERSION |
84 | |
85 | This is $Revision: 1.7 $. |
86 | |
87 | =head1 BUGS |
88 | |
89 | The B<-u> switch might not work for charsets other than Latin-1. You |
90 | might try to convert the kenny.pl script using B<recode> to change it |
91 | from Latin-1 to your preferred charset. |
92 | |
93 | =head1 CREDITS |
94 | |
95 | kenny.pl was written by B<Christian Garbs>. Look on his homepage for |
96 | newer versions of kenny.pl. Bug reports or comments about the program |
97 | should be sent to him: |
98 | Christian Garbs <F<mitch@cgarbs.de>> |
99 | F<http://www.cgarbs.de/weird.en.html> |
100 | |
101 | KennySpeak was invented by B<Kohan Ikin>. See his homepage for an |
102 | online version of the original B<KennyTranslator>: |
103 | Kohan Ikin <F<syneryder@namesuppressed.com>> |
104 | F<http://www.namesuppressed.com/kenny/> |
105 | |
106 | Alan Eldridge <F<alane@geeksrus.net>> patched in a signal handler to |
107 | print an appropriate message when kenny.pl is killed. |
108 | |
109 | =head1 COPYRIGHT |
110 | |
111 | kenny.pl is licensed unter the B<Artistic License> which can be found |
112 | at F<http://www.perl.com/language/misc/Artistic.html>. This license |
113 | has been chosen for keeping compatibility with the original KennySpeak |
114 | format. |
115 | |
116 | =cut |
117 | |
118 | |
119 | |
120 | ###################################################################### |
121 | # |
122 | # CHANGELOG |
123 | # |
124 | # $Log: kenny.pl,v $ |
125 | # Revision 1.7 2002/01/06 22:09:52 mitch |
126 | # Included patch by Alan Eldridge <alane@geeksrus.net> |
127 | # to show a message when kenny.pl is killed. |
128 | # |
129 | # Revision 1.6 2001/07/20 19:04:49 mitch |
130 | # Removed warnings with Perl 5.6. |
131 | # Thanks go to Alan Eldridge <alane@geeksrus.net> |
132 | # |
133 | # Revision 1.5 2001/07/15 10:27:57 mitch |
134 | # Included notice about -u and charsets other than Latin-1. |
135 | # |
136 | # Revision 1.4 2001/07/14 13:16:30 mitch |
137 | # Initial release. |
138 | # |
139 | # |
140 | # |
141 | ###################################################################### |
142 | |
143 | |
144 | |
145 | # |
146 | # finally{}, the source code! |
147 | # |
148 | |
149 | |
150 | |
151 | ##### Declaration of function prototypes |
152 | |
153 | sub generateKenny(); |
154 | sub generateDeKenny($); |
155 | sub guessDialect($); |
156 | sub translate($); |
157 | sub addGermanUmlauts($); |
158 | sub printHelp(); |
159 | sub theyKilledKenny(); |
160 | |
161 | |
162 | |
163 | ##### Default values for various option: |
164 | |
165 | my $dialect = 0; # Translate from or to KennySpeak? |
166 | # 0=guess, 1=encode, 2=decode |
167 | |
168 | my $umlauts = 0; # Convert German Umlauts before translation? |
169 |