From 45b3318d5d9495828601881faae16ed69d6fe8db Mon Sep 17 00:00:00 2001 From: organiker Date: Sat, 4 Apr 2015 18:07:54 +0000 Subject: [PATCH] Created my first Goodie --- lib/DDG/Goodie/IsAwesome/organiker.pm | 47 +++++++++++++++++++++++++++ t/IsAwesome/organiker.t | 19 +++++++++++ 2 files changed, 66 insertions(+) create mode 100644 lib/DDG/Goodie/IsAwesome/organiker.pm create mode 100644 t/IsAwesome/organiker.t diff --git a/lib/DDG/Goodie/IsAwesome/organiker.pm b/lib/DDG/Goodie/IsAwesome/organiker.pm new file mode 100644 index 000000000..04ea8b1dc --- /dev/null +++ b/lib/DDG/Goodie/IsAwesome/organiker.pm @@ -0,0 +1,47 @@ +package DDG::Goodie::IsAwesome::organiker; +# ABSTRACT: Write an abstract here +# Start at https://duck.co/duckduckhack/goodie_overview if you are new +# to instant answer development + +use DDG::Goodie; + +zci answer_type => "is_awesome_organiker"; +zci is_cached => 1; + +# Metadata. See https://duck.co/duckduckhack/metadata for help in filling out this section. +name "IsAwesome organiker"; +description "Succinct explanation of what this instant answer does"; +primary_example_queries "first example query", "second example query"; +secondary_example_queries "optional -- demonstrate any additional triggers"; +# Uncomment and complete: https://duck.co/duckduckhack/metadata#category +# category ""; +# Uncomment and complete: https://duck.co/duckduckhack/metadata#topics +# topics ""; +code_url "https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/IsAwesome/organiker.pm"; +attribution github => ["GitHubAccount", "Friendly Name"], + twitter => "twitterhandle"; + +# Triggers +# triggers any => "triggerWord", "trigger phrase"; +triggers start => "duckduckhack organiker"; + +# Handle statement +# handle remainder => sub { + +# # optional - regex guard +# # return unless qr/^\w+/; + +# return unless $_; # Guard against "no answer" + +# return $_; +# }; + +handle remainder => sub { + + return "organiker is awesome and has successfully completed the DuckDuckHack Goodie tutorial!"; +}; + + + + +1; diff --git a/t/IsAwesome/organiker.t b/t/IsAwesome/organiker.t new file mode 100644 index 000000000..1b34bc408 --- /dev/null +++ b/t/IsAwesome/organiker.t @@ -0,0 +1,19 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use Test::More; +use DDG::Test::Goodie; + +zci answer_type => "is_awesome_organiker"; +zci is_cached => 1; + +ddg_goodie_test( + [qw( + DDG::Goodie::IsAwesome::organiker + )], + 'duckduckhack organiker' => test_zci('organiker is awesome and has successfully completed the DuckDuckHack Goodie tutorial!'), + 'duckduckhack organiker is awesome' => undef, +); + +done_testing;