package DDG::Goodie::DuckDuckGo; # ABSTRACT: Return hard-coded descriptions for DuckDuckGo terms use DDG::Goodie; my %data = ( zeroclickinfo => "Zero Click Info is the term DuckDuckGo uses for these boxes, which often provide useful instant answers above traditional results.", zeroclick => \"zeroclickinfo", '0click' => \"zeroclickinfo", '0clickinfo' => \"zeroclickinfo", goodies => "DuckDuckGo's goodie repository: https://github.com/duckduckgo/zeroclickinfo-goodies", spice => "DuckDuckGo's spice repository: https://github.com/duckduckgo/zeroclickinfo-spice", longtail => "DuckDuckGo's longtail repository: https://github.com/duckduckgo/zeroclickinfo-longtail", fathead => "DuckDuckGo's fathead repository: https://github.com/duckduckgo/zeroclickinfo-fathead", goodies_html => "DuckDuckGo's goodie repository", spice_html => "DuckDuckGo's spice repository", longtail_html => "DuckDuckGo's longtail repository", fathead_html => "DuckDuckGo's fathead repository", help => "DuckDuckGo's help website: http://help.duckduckgo.com/", help_html => "DuckDuckGo's help website: http://help.duckduckgo.com/", roboduck_html => "DuckDuckGo's official IRC bot: https://github.com/Getty/duckduckgo-roboduck", roboduck => "DuckDuckGo's official IRC bot: https://github.com/Getty/duckduckgo-roboduck", quackandhack => "QUACK!", ); triggers any => keys %data, qw/zero 0/; zci is_cached => 1; primary_example_queries 'help'; secondary_example_queries 'Zero-Click Info', 'zeroclick'; description 'take the average of a list of numbers'; name 'DuckDuckGo'; code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/DuckDuckGo.pm'; category 'cheat_sheets'; topics 'everyday_goodies'; attribution twitter => 'crazedpsyc', cpan => 'CRZEDPSYC' ; handle query_nowhitespace_nodash => sub { $_ = lc; s/\W//g; s/^duckduckgo//i; s/repo(?:sitory)?//i; return unless exists $data{$_}; my $answer = $data{$_}; my $answerhtml = exists $data{"${_}_html"} ? $data{"${_}_html"} : 0; if (ref $answer eq 'SCALAR') { $answer = $data{$$answer}; $answerhtml = exists $data{"${answer}_html"} ? $data{"${answer}_html"} : 0; } return $answer unless $answerhtml; return $answer, html => $answerhtml; }; 1;