From 0722a20ccc3e6cc6428235d948b5b45c07770c3a Mon Sep 17 00:00:00 2001 From: Robert Picard Date: Mon, 14 May 2012 20:52:54 -0400 Subject: [PATCH] Flip and mirror both mirror now There aren't hex codes for characters that aren't mirrored, i.e. just flipped upside-down, so the "flip" trigger wasn't really working. --- lib/DDG/Goodie/FlipText.pm | 14 ++------------ t/FlipText.t | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/lib/DDG/Goodie/FlipText.pm b/lib/DDG/Goodie/FlipText.pm index 26396154c..64512e56f 100644 --- a/lib/DDG/Goodie/FlipText.pm +++ b/lib/DDG/Goodie/FlipText.pm @@ -87,19 +87,9 @@ my %charMap = ( "<" => ">", "_" => "\x{203E}"); -handle sub { +handle remainder => sub { - $_ =~ s/^(\s*flip\s*)//; - $_ =~ s/(\s*flip\s*)$//; - - if ($_ =~ /^(\s*mirror\s*)/ || $_ =~ /(\s*mirror\s*)/) { - $_ =~ s/^(\s*mirror\s*)//; - $_ =~ s/(\s*mirror\s*)$//; - - $_ = reverse $_; - } - - my @string = split(//, $_); + my @string = split(//, reverse $_); my $flippedString; for (@string) { diff --git a/t/FlipText.t b/t/FlipText.t index 02ff073ed..bb2aa4141 100644 --- a/t/FlipText.t +++ b/t/FlipText.t @@ -13,7 +13,7 @@ ddg_goodie_test( DDG::Goodie::FlipText )], 'flip test' => test_zci("\x{0287}\x{01DD}\x{0073}\x{0287}"), - 'mirror test' => test_zci("\x{0287}\x{0073}\x{01DD}\x{0287}"), + 'mirror test' => test_zci("\x{0287}\x{01DD}\x{0073}\x{0287}"), ); done_testing;