| 1 | #!/usr/local/bin/perl -w | ||||||||||
| 2 | ###################################################################### | ||||||||||
| 3 | # Copyright 2002, Tim Maher. tim@teachmeperl.com All Rights Reserved # | ||||||||||
| 4 | ###################################################################### | ||||||||||
| 5 | # name2verse.pl: Uses Lingua::EN::Namegame to make verse from name | ||||||||||
| 6 | |||||||||||
| 7 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 4 | ▶ | use Lingua::EN::Namegame; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | # Default argument simplifies testing | ||||||||||
| 12 | 4 | ▶ | @ARGV or @ARGV=qw(krusty); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | |||||||||||
| 14 | 4 | my $name = ($ARGV[0]); | |||||||||
| 15 | 4 | my $verse = name2verse($ARGV[0]); | |||||||||
| 16 | |||||||||||
| 17 | 4 | ▶ | if (defined $verse) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 4 | print "$verse\n\n"; | |||||||||
| 19 | } | ||||||||||
| 20 | else { | ||||||||||
| 21 | 0 | warn "Error creating verse for $name\n\n"; # this shouldn't happen | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||