]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/perl | |
2 | # jibberish -- run filters in random order | |
3 | ||
4 | $ENV{PATH}.=":/usr/games"; | |
5 | ||
6 | @all= qw( | |
7 | eleet | |
8 | b1ff | |
9 | chef | |
10 | jethro | |
11 | upside-down | |
12 | kraut | |
13 | cockney | |
14 | jive | |
15 | nyc | |
16 | ken | |
17 | ky00te | |
18 | rasterman | |
19 | newspeak | |
20 | studly | |
21 | censor | |
22 | spammer | |
23 | ); | |
24 | ||
25 | # shuffle order | |
26 | srand; | |
27 | for (0..$#all) { | |
28 | my $n= @all*rand; | |
29 | my $was= $all[$_]; | |
30 | $all[$_]= $all[$n]; | |
31 | $all[$n]= $was; | |
32 | } | |
33 | ||
34 | # start the pipe... | |
35 | my $pipe= join '|', @all[0..3 + rand(5)]; | |
36 | open FILTER, "$pipe|" | |
37 | or die "Never mind...\n"; | |
38 | ||
39 | # display the results | |
40 | while (<FILTER>) { | |
41 | print $_ | |
42 | } | |
43 | ||
44 | # This could be optimized: take the last program off the pipeline, | |
45 | # open the pipeline as standard input, then exec that last program. | |
46 | # | |
47 | # But you have to ask yourself: how important is it to optimize | |
48 | # the generation of jibberish? |