2012-05-28 13:02:54 -07:00
|
|
|
package DDG::Goodie::Morse;
|
|
|
|
# ABSTRACT: Converts to/from Morse code
|
|
|
|
|
|
|
|
use DDG::Goodie;
|
|
|
|
use Convert::Morse qw(is_morse as_ascii as_morse);
|
|
|
|
|
|
|
|
attribution
|
|
|
|
web => 'http://und3f.com',
|
|
|
|
twitter => 'und3f',
|
|
|
|
github => 'und3f',
|
|
|
|
cpan => 'UNDEF';
|
|
|
|
|
2012-06-02 13:17:04 -07:00
|
|
|
triggers startend => 'morse', 'morse code';
|
2012-05-28 13:02:54 -07:00
|
|
|
|
|
|
|
zci is_cached => 1;
|
|
|
|
zci answer_type => 'chars';
|
|
|
|
|
|
|
|
handle remainder => sub {
|
|
|
|
return unless $_;
|
|
|
|
|
|
|
|
my $convertor = is_morse($_) ? \&as_ascii : \&as_morse;
|
2012-06-02 08:00:02 -07:00
|
|
|
return "Morse code: " . $convertor->($_);
|
2012-05-28 13:02:54 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
1;
|