Permalink
Browse files

fixes for new DDG (using strict)

  • Loading branch information...
1 parent fbff1c8 commit f7cd676c9529d1911d98eb16ce9b44cb6dd3d25d @crazedpsyc crazedpsyc committed May 2, 2012
Showing with 9 additions and 8 deletions.
  1. +1 −0 .gitignore
  2. +1 −1 lib/DDG/Goodie/DaysBetween.pm
  3. +5 −5 lib/DDG/Goodie/FlipText.pm
  4. +2 −2 lib/DDG/Goodie/NLetterWords.pm
View
1 .gitignore
@@ -1,2 +1,3 @@
DDG-*
.build
+*.sw*
View
2 lib/DDG/Goodie/DaysBetween.pm
@@ -21,7 +21,7 @@ handle query_lc => sub {
}
if(scalar(@dates) == 6) {
- my $inclusive, $days1, $days2;
+ my ($inclusive, $days1, $days2);
eval {
$days1 = Date_to_Days(@dates[2,0,1]);
View
10 lib/DDG/Goodie/FlipText.pm
@@ -91,16 +91,16 @@ handle remainder => sub {
my @string = split(//,reverse $_);
my $flippedString;
- foreach $char (@string) {
+ for (@string) {
# Not all uppercase letters can be flipped
- $char = lc($char);
+ $_ = lc;
- if ( exists $charMap{$char}) {
- $flippedString .= $charMap{$char};
+ if ( exists $charMap{$_}) {
+ $flippedString .= $charMap{$_};
}
else {
- $flippedString .= $char;
+ $flippedString .= $_;
}
}
return $flippedString;
View
4 lib/DDG/Goodie/NLetterWords.pm
@@ -15,7 +15,7 @@ handle query_parts => sub {
my @allwords = share('words.txt')->slurp;
my @words;
- foreach (@allwords) {
+ for (@allwords) {
chomp($_);
if (length($_) == $length) { push(@words, $_); }
}
@@ -24,7 +24,7 @@ handle query_parts => sub {
my @randomwords;
if (scalar(@words) > 30) {
while (scalar(@randomwords) < 30) {
- $rand = int(rand(scalar(@words)));
+ my $rand = int(rand(scalar(@words)));
if ($words[$rand]) {
push(@randomwords, $words[$rand]);
$words[$rand] = 0;

0 comments on commit f7cd676

Please sign in to comment.