File Coverage

blib/lib/DDG/Meta.pm
Criterion Covered Total %
statement 73 73 100.0
branch 2 4 50.0
condition 1 3 33.3
subroutine 21 21 100.0
pod 5 5 100.0
total 102 106 96.2


line stmt bran cond sub pod time code
1             package DDG::Meta;
2             our $AUTHORITY = 'cpan:DDG';
3             # ABSTRACT: Main meta layer implementation factory... dark side of the moon...
4             $DDG::Meta::VERSION = '1016';
5 11     11   36 use strict;
  11         11  
  11         232  
6 11     11   31 use warnings;
  11         11  
  11         183  
7 11     11   30 use Carp;
  11         13  
  11         575  
8             require Data::Printer;
9              
10 11     11   3820 use DDG::Meta::RequestHandler;
  11         22  
  11         284  
11 11     11   3704 use DDG::Meta::ZeroClickInfo;
  11         23  
  11         265  
12 11     11   3160 use DDG::Meta::ZeroClickInfoSpice;
  11         26  
  11         327  
13 11     11   4795 use DDG::Meta::Fathead;
  11         22  
  11         273  
14 11     11   3782 use DDG::Meta::ShareDir;
  11         28  
  11         320  
15 11     11   3944 use DDG::Meta::Block;
  11         19  
  11         251  
16 11     11   3865 use DDG::Meta::Information;
  11         22  
  11         281  
17 11     11   3617 use DDG::Meta::Helper;
  11         19  
  11         250  
18 11     11   3600 use DDG::Meta::AnyBlock;
  11         20  
  11         255  
19 11     11   3613 use DDG::Meta::CountryCodes;
  11         25  
  11         335  
20              
21 11     11   3939 use MooX ();
  11         22050  
  11         3117  
22              
23             require Moo::Role;
24              
25              
26             sub apply_base_to_package {
27 45     45 1 68 my ( $class, $target ) = @_;
28              
29 45         303 MooX->import::into($target, qw(
30             +Data::Printer
31             ));
32             }
33              
34              
35             sub apply_goodie_keywords {
36 24     24 1 47 my ( $class, $target ) = @_;
37 24         158 DDG::Meta::ZeroClickInfo->apply_keywords($target);
38 24         160 DDG::Meta::ShareDir->apply_keywords($target);
39 24         154 DDG::Meta::Block->apply_keywords($target);
40 24         17742 DDG::Meta::Information->apply_keywords($target);
41 24         7479 DDG::Meta::Helper->apply_keywords($target);
42             DDG::Meta::RequestHandler->apply_keywords($target,sub {
43             shift->zci_new(
44 34 50 33 34   373 scalar @_ == 1 && ref $_[0] eq 'HASH' ? $_[0] :
    50          
45             @_ % 2 ? ( answer => @_ ) : @_
46             );
47 24         221 },'DDG::IsGoodie');
48             }
49              
50              
51             sub apply_spice_keywords {
52 11     11 1 20 my ( $class, $target ) = @_;
53 11         65 DDG::Meta::ZeroClickInfoSpice->apply_keywords($target);
54 11         69 DDG::Meta::ShareDir->apply_keywords($target);
55 11         69 DDG::Meta::Block->apply_keywords($target);
56 11         8164 DDG::Meta::Information->apply_keywords($target);
57 11         3617 DDG::Meta::Helper->apply_keywords($target);
58             DDG::Meta::RequestHandler->apply_keywords($target,sub {
59 11     11   39 shift->spice_new(@_);
60 11         91 },'DDG::IsSpice');
61             }
62              
63              
64             sub apply_fathead_keywords {
65 5     5 1 13 my ( $class, $target ) = @_;
66 5         38 DDG::Meta::ZeroClickInfo->apply_keywords($target);
67 5         34 DDG::Meta::ShareDir->apply_keywords($target);
68 5         33 DDG::Meta::Fathead->apply_keywords($target);
69 5         34 DDG::Meta::Information->apply_keywords($target);
70 5         2108 DDG::Meta::AnyBlock->apply_keywords($target);
71 5         3206 Moo::Role->apply_role_to_package($target, "DDG::IsFathead");
72             }
73              
74              
75             sub apply_longtail_keywords {
76 5     5 1 9 my ( $class, $target ) = @_;
77 5         38 DDG::Meta::ZeroClickInfo->apply_keywords($target);
78 5         39 DDG::Meta::ShareDir->apply_keywords($target);
79 5         37 DDG::Meta::Information->apply_keywords($target);
80 5         2223 DDG::Meta::AnyBlock->apply_keywords($target);
81 5         3597 Moo::Role->apply_role_to_package($target, "DDG::IsLongtail");
82             }
83              
84             1;
85              
86             __END__