zeroclickinfo-goodies/lib/DDG/Goodie/Roman.pm

19 lines
421 B
Perl
Raw Normal View History

2012-02-29 15:21:49 -08:00
package DDG::Goodie::Roman;
use DDG::Goodie;
use Roman;
2012-04-26 19:18:47 -07:00
triggers any => "roman", "arabic";
2012-02-29 15:21:49 -08:00
zci is_cached => 1;
2012-03-20 21:08:12 -07:00
zci answer_type => "roman_numeral_conversion";
2012-02-29 15:21:49 -08:00
handle remainder => sub {
2012-04-26 19:18:47 -07:00
s/\s*(?:numeral|number)\s*//i;
2012-03-24 11:05:13 -07:00
return uc(roman($_)) . ' (roman numeral conversion)' if /^\d+$/ && roman($_);
2012-04-03 11:55:26 -07:00
return arabic($_) . ' (roman numeral conversion)' if lc($_) =~ /^[mdclxvi]+$/ && arabic($_);
2012-02-29 15:21:49 -08:00
return;
};
1;