Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More meta documentation, fixed some EOL, updated proper no_index via …

…dist.ini
  • Loading branch information...
commit d0b286b4e557276f613e9a9a3e2c6beb6767fa16 1 parent 1e7acf1
@Getty Getty authored
View
6 dist.ini
@@ -49,6 +49,12 @@ File::Temp = 0.22
[MetaJSON]
[MetaYAML]
+[MetaNoIndex]
+directory = t/
+directory = xt/
+directory = ex/
+directory = inc/
+
[Git::NextVersion]
version_regexp = ^(.+)$
[PkgVersion]
View
5 lib/DDG/Meta/Block.pm
@@ -10,9 +10,6 @@ require Moo::Role;
=head1 DESCRIPTION
-=cut
-
-my %applied;
=method apply_keywords
@@ -22,6 +19,8 @@ It also adds the role L<DDG::Block::Blockable> to the target classname.
=cut
+my %applied;
+
sub apply_keywords {
my ( $class, $target ) = @_;
View
5 lib/DDG/Meta/RequestHandler.pm
@@ -50,8 +50,13 @@ L<DDG::Spice>.
=cut
+my %applied;
+
sub apply_keywords {
my ( $class, $target, $result_handler, $role ) = @_;
+
+ return if exists $applied{$target};
+ $applied{$target} = undef;
my $stash = Package::Stash->new($target);
View
6 lib/DDG/Meta/ShareDir.pm
@@ -21,10 +21,6 @@ at the proper directory inside the repository, else it will fail. You cant
define that directory for yourself, the complete concept requires staying to
the convention, see L</module_share_dir>.
-=cut
-
-my %applied;
-
=method apply_keywords
Uses a given classname to install the described keywords.
@@ -34,6 +30,8 @@ class has a sharedir.
=cut
+my %applied;
+
sub apply_keywords {
my ( $class, $target ) = @_;
View
62 lib/DDG/Meta/ZeroClickInfo.pm
@@ -1,4 +1,5 @@
package DDG::Meta::ZeroClickInfo;
+# ABSTRACT: Functions for generating a L<DDG::ZeroClickInfo> factory
use strict;
use warnings;
@@ -24,14 +25,15 @@ sub zeroclickinfo_attributes {qw(
ttl
)}
-sub check_zeroclickinfo_key {
- my $key = shift;
- if (grep { $key eq $_ } zeroclickinfo_attributes) {
- return $key;
- } else {
- croak $key." is not supported on DDG::ZeroClickInfo";
- }
-}
+=head1 DESCRIPTION
+
+=cut
+
+=method apply_keywords
+
+Uses a given classname to install the described keywords.
+
+=cut
my %applied;
@@ -52,10 +54,16 @@ sub apply_keywords {
answer_type => $answer_type,
);
- $stash->add_symbol('&zci_new', sub {
- shift;
- DDG::ZeroClickInfo->new( %zci_params, ref $_[0] eq 'HASH' ? %{$_[0]} : @_ );
- });
+=keyword zci
+
+This function applies default parameter to the L<DDG::ZeroClickInfo> that you
+can generate via L</zci_new>. All keys given are checked through a list of
+possible L<DDG::ZeroClickInfo> attributes.
+
+ zci is_cached => 1;
+ zci answer_type => 'random';
+
+=cut
$stash->add_symbol('&zci', sub {
if (ref $_[0] eq 'HASH') {
@@ -71,6 +79,36 @@ sub apply_keywords {
}
});
+=keyword zci_new
+
+This function gives back a L<DDG::ZeroClickInfo> set with the parameter given
+on L</zci> and then overridden and extended through the parameter given to
+this function.
+
+=cut
+
+ $stash->add_symbol('&zci_new', sub {
+ shift;
+ DDG::ZeroClickInfo->new( %zci_params, ref $_[0] eq 'HASH' ? %{$_[0]} : @_ );
+ });
+
+}
+
+=method check_zeroclickinfo_key
+
+This function checks (and returns) the given parameter as possible parameter for
+L<DDG::ZeroClickInfo>. The list of possible parameter is given here in this
+package.
+
+=cut
+
+sub check_zeroclickinfo_key {
+ my $key = shift;
+ if (grep { $key eq $_ } zeroclickinfo_attributes) {
+ return $key;
+ } else {
+ croak $key." is not supported on DDG::ZeroClickInfo";
+ }
}
1;
View
19 lib/DDG/Meta/ZeroClickInfoSpice.pm
@@ -1,4 +1,5 @@
package DDG::Meta::ZeroClickInfoSpice;
+# ABSTRACT: Functions for generating a L<DDG::ZeroClickInfo::Spice> factory
use strict;
use warnings;
@@ -25,15 +26,6 @@ sub zeroclickinfospice_attributes {qw(
ttl
)}
-sub check_zeroclickinfospice_key {
- my $key = shift;
- if (grep { $key eq $_ } zeroclickinfospice_attributes) {
- return $key;
- } else {
- croak $key." is not supported on DDG::ZeroClickInfo::Spice";
- }
-}
-
my %applied;
sub apply_keywords {
@@ -191,4 +183,13 @@ sub apply_keywords {
}
+sub check_zeroclickinfospice_key {
+ my $key = shift;
+ if (grep { $key eq $_ } zeroclickinfospice_attributes) {
+ return $key;
+ } else {
+ croak $key." is not supported on DDG::ZeroClickInfo::Spice";
+ }
+}
+
1;
View
70 t/21-language.t
@@ -1,35 +1,35 @@
-#!/usr/bin/env perl
-
-use strict;
-use warnings;
-use Test::More;
-use utf8;
-
-use FindBin qw($Bin);
-use lib "$Bin/lib";
-
-use DDG::Test::Goodie;
-use DDG::Test::Language;
-use DDG::Request;
-
-zci answer_type => 'language';
-
-my @language_tests = (
- de => 'German of Germany de_DE',
- my => 'Malay in Malaysia ms_MY',
-);
-
-while (@language_tests) {
- my $language_key = shift @language_tests;
- my $expected_reply = shift @language_tests;
- my $lang = test_language($language_key);
- my $req = DDG::Request->new( query_raw => "my language", language => $lang );
- ddg_goodie_test(
- [qw(
- DDGTest::Goodie::Language
- )],
- $req, test_zci($expected_reply),
- );
-}
-
-done_testing;
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use Test::More;
+use utf8;
+
+use FindBin qw($Bin);
+use lib "$Bin/lib";
+
+use DDG::Test::Goodie;
+use DDG::Test::Language;
+use DDG::Request;
+
+zci answer_type => 'language';
+
+my @language_tests = (
+ de => 'German of Germany de_DE',
+ my => 'Malay in Malaysia ms_MY',
+);
+
+while (@language_tests) {
+ my $language_key = shift @language_tests;
+ my $expected_reply = shift @language_tests;
+ my $lang = test_language($language_key);
+ my $req = DDG::Request->new( query_raw => "my language", language => $lang );
+ ddg_goodie_test(
+ [qw(
+ DDGTest::Goodie::Language
+ )],
+ $req, test_zci($expected_reply),
+ );
+}
+
+done_testing;
View
16 t/lib/DDGTest/Goodie/Language.pm
@@ -1,9 +1,9 @@
-package DDGTest::Goodie::Language;
-
-use DDG::Goodie;
-
-triggers any => "my language";
-
-handle sub { join(" ",$lang->name_in_english,$lang->locale) };
-
+package DDGTest::Goodie::Language;
+
+use DDG::Goodie;
+
+triggers any => "my language";
+
+handle sub { join(" ",$lang->name_in_english,$lang->locale) };
+
1;
Please sign in to comment.
Something went wrong with that request. Please try again.