| 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 | pirate |
| 16 | nyc |
| 17 | ken |
| 18 | ky00te |
| 19 | rasterman |
| 20 | newspeak |
| 21 | studly |
| 22 | censor |
| 23 | spammer |
| 24 | ); |
| 25 | |
| 26 | # shuffle order |
| 27 | srand; |
| 28 | for (0..$#all) { |
| 29 | my $n= @all*rand; |
| 30 | my $was= $all[$_]; |
| 31 | $all[$_]= $all[$n]; |
| 32 | $all[$n]= $was; |
| 33 | } |
| 34 | |
| 35 | # start the pipe... |
| 36 | my $pipe= join '|', @all[0..3 + rand(5)]; |
| 37 | open FILTER, "$pipe|" |
| 38 | or die "Never mind...\n"; |
| 39 | |
| 40 | # display the results |
| 41 | while (<FILTER>) { |
| 42 | print $_ |
| 43 | } |
| 44 | |
| 45 | # This could be optimized: take the last program off the pipeline, |
| 46 | # open the pipeline as standard input, then exec that last program. |
| 47 | # |
| 48 | # But you have to ask yourself: how important is it to optimize |
| 49 | # the generation of jibberish? |