|  line  | 
 stmt  | 
 bran  | 
 cond  | 
 sub  | 
 pod  | 
 time  | 
 code  | 
| 
1
 | 
  
 
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 package DDG::Meta::ZeroClickInfo;  | 
| 
2
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 our $AUTHORITY = 'cpan:DDG';  | 
| 
3
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 # ABSTRACT: Functions for generating a L factory  | 
| 
4
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 $DDG::Meta::ZeroClickInfo::VERSION = '1018';  | 
| 
5
 | 
11
 | 
 
 | 
 
 | 
  
11
  
 | 
 
 | 
79
 | 
 use strict;  | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
43
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
348
 | 
    | 
| 
6
 | 
11
 | 
 
 | 
 
 | 
  
11
  
 | 
 
 | 
66
 | 
 use warnings;  | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
26
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
323
 | 
    | 
| 
7
 | 
11
 | 
 
 | 
 
 | 
  
11
  
 | 
 
 | 
65
 | 
 use Carp;  | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
25
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
713
 | 
    | 
| 
8
 | 
11
 | 
 
 | 
 
 | 
  
11
  
 | 
 
 | 
2237
 | 
 use DDG::ZeroClickInfo;  | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
45
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
415
 | 
    | 
| 
9
 | 
11
 | 
 
 | 
 
 | 
  
11
  
 | 
 
 | 
98
 | 
 use Package::Stash;  | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
25
 | 
    | 
| 
 
 | 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
4049
 | 
    | 
| 
10
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
11
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 my %supported_zci_attributes = map { $_ => 1 } (qw(  | 
| 
12
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       abstract  | 
| 
13
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       abstract_text  | 
| 
14
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       abstract_source  | 
| 
15
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       abstract_url  | 
| 
16
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       caller  | 
| 
17
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       image  | 
| 
18
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       heading  | 
| 
19
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       answer  | 
| 
20
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       answer_type  | 
| 
21
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       definition  | 
| 
22
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       definition_source  | 
| 
23
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       definition_url  | 
| 
24
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       type  | 
| 
25
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       is_cached  | 
| 
26
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       is_unsafe  | 
| 
27
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
       ttl  | 
| 
28
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 ));  | 
| 
29
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
30
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
31
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
32
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 my %applied;  | 
| 
33
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 sub apply_keywords {  | 
| 
35
 | 
34
 | 
 
 | 
 
 | 
  
34
  
 | 
  
1
  
 | 
111
 | 
 	my ( $class, $target ) = @_;  | 
| 
36
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
37
 | 
34
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
172
 | 
 	return if exists $applied{$target};  | 
| 
38
 | 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
99
 | 
 	$applied{$target} = undef;  | 
| 
39
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
40
 | 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
189
 | 
 	my @parts = split('::',$target);  | 
| 
41
 | 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
90
 | 
 	shift @parts;  | 
| 
42
 | 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
79
 | 
 	shift @parts;  | 
| 
43
 | 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
155
 | 
 	my $answer_type = lc(join(' ',@parts));  | 
| 
44
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
45
 | 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
466
 | 
 	my $stash = Package::Stash->new($target);  | 
| 
46
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
47
 | 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
234
 | 
 	my %zci_params = (  | 
| 
48
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
         caller      => $target,  | 
| 
49
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 		answer_type => $answer_type,  | 
| 
50
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	);  | 
| 
51
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
52
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
53
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
54
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
     $stash->add_symbol( '&zci', sub {  | 
| 
55
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
  
0
  
 | 
 
 | 
0
 | 
             my %kv = (ref $_[0] eq 'HASH') ? %{$_[0]} : @_;  | 
| 
 
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
    | 
| 
56
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
             while (my ($key, $value) = each(%kv)) {  | 
| 
57
 | 
  
0
  
 | 
  
  0
  
 | 
 
 | 
 
 | 
 
 | 
0
 | 
                 croak $key. " is not supported on DDG::ZeroClickInfo" unless (exists $supported_zci_attributes{$key});  | 
| 
58
 | 
  
0
  
 | 
 
 | 
 
 | 
 
 | 
 
 | 
0
 | 
                 $zci_params{$key} = $value;  | 
| 
59
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
             }  | 
| 
60
 | 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
591
 | 
         });  | 
| 
61
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
62
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
63
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 	$stash->add_symbol('&zci_new', sub {  | 
| 
64
 | 
34
 | 
 
 | 
 
 | 
  
34
  
 | 
 
 | 
76
 | 
 		shift;  | 
| 
 
 | 
 
 | 
 
 | 
 
 | 
  
31
  
 | 
 
 | 
 
 | 
    | 
| 
 
 | 
 
 | 
 
 | 
 
 | 
  
3
  
 | 
 
 | 
 
 | 
    | 
| 
65
 | 
34
 | 
  
 50
  
 | 
 
 | 
 
 | 
 
 | 
847
 | 
 		DDG::ZeroClickInfo->new( %zci_params, ref $_[0] eq 'HASH' ? %{$_[0]} : @_ );  | 
| 
 
 | 
0
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
66
 | 
34
 | 
 
 | 
 
 | 
 
 | 
 
 | 
446
 | 
 	});  | 
| 
67
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
68
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 }  | 
| 
69
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
70
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 1;  | 
| 
71
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
    | 
| 
72
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 
 | 
 __END__  |