removed trigger person, as suggested, and renamed the files to be more specific
parent
a3ade793e1
commit
9477fb58a5
|
@ -1,4 +1,4 @@
|
|||
package DDG::Goodie::RandomPerson;
|
||||
package DDG::Goodie::RandomName;
|
||||
# ABSTRACT: Return random first and last name
|
||||
use DDG::Goodie;
|
||||
use Data::RandomPerson;
|
||||
|
@ -7,23 +7,19 @@ triggers start => 'random';
|
|||
zci answer_type => 'rand';
|
||||
|
||||
|
||||
name 'RandomPerson';
|
||||
description 'returns a random person';
|
||||
name 'RandomName';
|
||||
description 'returns a random and fictive title, first- and lastname and day of birth';
|
||||
category 'random';
|
||||
topics 'programming';
|
||||
primary_example_queries 'random person';
|
||||
secondary_example_queries 'random name';
|
||||
code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/RandomPerson.pm';
|
||||
attribution github => ['https://github.com/stelim', 'Stelim'],
|
||||
primary_example_queries 'random name';
|
||||
code_url 'https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/lib/DDG/Goodie/RandomName.pm';
|
||||
attribution github => ['https://github.com/stelim', 'Stefan Limbacher'],
|
||||
twitter => ['http://twitter.com/stefanlimbacher', 'Stefan Limbacher'];
|
||||
|
||||
handle remainder => sub {
|
||||
my $person = Data::RandomPerson->new()->create();
|
||||
|
||||
if ($_ =~ m{name}xmsi) {
|
||||
return "$person->{firstname} $person->{lastname}";
|
||||
}
|
||||
elsif ($_ =~ m{person}xmsi) {
|
||||
return "$person->{title}. $person->{firstname} $person->{lastname}, born $person->{dob}";
|
||||
}
|
||||
else {
|
|
@ -0,0 +1,21 @@
|
|||
#! /usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More;
|
||||
use DDG::Test::Goodie;
|
||||
|
||||
zci answer_type => 'rand';
|
||||
zci is_cached => 0;
|
||||
|
||||
ddg_goodie_test(
|
||||
[
|
||||
'DDG::Goodie::RandomName'
|
||||
],
|
||||
'random Name' => test_zci (qr/\w+\. \w+ \w+, born \d+-\d+-\d+/),
|
||||
'random name' => test_zci (qr/\w+\. \w+ \w+, born \d+-\d+-\d+/),
|
||||
|
||||
|
||||
);
|
||||
|
||||
done_testing;
|
|
@ -1,23 +0,0 @@
|
|||
#! /usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More;
|
||||
use DDG::Test::Goodie;
|
||||
|
||||
zci answer_type => 'rand';
|
||||
zci is_cached => 0;
|
||||
|
||||
ddg_goodie_test(
|
||||
[
|
||||
'DDG::Goodie::RandomPerson'
|
||||
],
|
||||
'random Name' => test_zci (qr/\w+ \w+/),
|
||||
'random name' => test_zci (qr/\w+ \w+/),
|
||||
'random Person' => test_zci (qr/\w+\. \w+ \w+, born \d+-\d+-\d+/),
|
||||
'random person' => test_zci (qr/\w+\. \w+ \w+, born \d+-\d+-\d+/),
|
||||
|
||||
|
||||
);
|
||||
|
||||
done_testing;
|
Loading…
Reference in New Issue