this patch adds a feature to let this generate acronyms for any string.
Subject: | Acme-POE-Acronym-Generator-1.00.diff |
Only in Acme-POE-Acronym-Generator-1.00.crf: Makefile
Only in Acme-POE-Acronym-Generator-1.00.crf: blib
diff -ur Acme-POE-Acronym-Generator-1.00/lib/Acme/POE/Acronym/Generator.pm Acme-POE-Acronym-Generator-1.00.crf/lib/Acme/POE/Acronym/Generator.pm
--- Acme-POE-Acronym-Generator-1.00/lib/Acme/POE/Acronym/Generator.pm 2007-04-05 09:08:06.000000000 -0600
+++ Acme-POE-Acronym-Generator-1.00.crf/lib/Acme/POE/Acronym/Generator.pm 2007-05-11 14:10:31.000000000 -0600
@@ -12,10 +12,14 @@
$opts{lc $_} = delete $opts{$_} for keys %opts;
$opts{dict} = '/usr/share/dict/words' unless $opts{dict};
my $self = bless \%opts, $package;
+
+ $self->{poe} = [ $opts{key}? split( //, $opts{key} ) : qw(p o e) ];
+ my $key = join "", @{$self->{poe}};
+
if ( $opts{wordlist} and ref $opts{wordlist} eq 'ARRAY' ) {
for ( @{ $opts{wordlist} } ) {
chomp;
- next unless /^[poe]\w+$/;
+ next unless /^[$key]\w+$/;
push @{ $self->{words}->{ substr($_,0,1) } }, $_;
}
return $self;
@@ -24,7 +28,8 @@
open my $fh, "<", $self->{dict} or die "$!\n";
while (<$fh>) {
chomp;
- next unless /^[poe]\w+$/;
+ next unless /^[$key]\w+$/;
+ # next unless /^[poe]\w+$/;
push @{ $self->{words}->{ substr($_,0,1) } }, $_;
}
close $fh;
@@ -45,7 +50,7 @@
my $words = $self->{words};
my @poe;
push @poe,
- ucfirst( $words->{$_}->[ scalar random_uniform_integer(1,0,$#{ $words->{$_} } ) ] ) for qw(p o e);
+ ucfirst( $words->{$_}->[ scalar random_uniform_integer(1,0,$#{ $words->{$_} } ) ] ) for ( @{$self->{poe}} );
return wantarray ? @poe : join( ' ', @poe );
}
Only in Acme-POE-Acronym-Generator-1.00.crf/lib/Acme/POE/Acronym: Generator.pm~
Only in Acme-POE-Acronym-Generator-1.00.crf: perltidy.ERR
Only in Acme-POE-Acronym-Generator-1.00.crf: pm_to_blib
Only in Acme-POE-Acronym-Generator-1.00.crf/t: 04_key.t
Only in Acme-POE-Acronym-Generator-1.00.crf/t: 04_key.t~