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 = '1017'; |
5
|
11
|
|
|
11
|
|
66
|
use strict; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
260
|
|
6
|
11
|
|
|
11
|
|
49
|
use warnings; |
|
11
|
|
|
|
|
21
|
|
|
11
|
|
|
|
|
209
|
|
7
|
11
|
|
|
11
|
|
45
|
use Carp; |
|
11
|
|
|
|
|
21
|
|
|
11
|
|
|
|
|
520
|
|
8
|
11
|
|
|
11
|
|
2121
|
use DDG::ZeroClickInfo; |
|
11
|
|
|
|
|
30
|
|
|
11
|
|
|
|
|
294
|
|
9
|
11
|
|
|
11
|
|
65
|
use Package::Stash; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
3016
|
|
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
|
90
|
my ( $class, $target ) = @_; |
36
|
|
|
|
|
|
|
|
37
|
34
|
50
|
|
|
|
131
|
return if exists $applied{$target}; |
38
|
34
|
|
|
|
|
82
|
$applied{$target} = undef; |
39
|
|
|
|
|
|
|
|
40
|
34
|
|
|
|
|
153
|
my @parts = split('::',$target); |
41
|
34
|
|
|
|
|
71
|
shift @parts; |
42
|
34
|
|
|
|
|
67
|
shift @parts; |
43
|
34
|
|
|
|
|
125
|
my $answer_type = lc(join(' ',@parts)); |
44
|
|
|
|
|
|
|
|
45
|
34
|
|
|
|
|
373
|
my $stash = Package::Stash->new($target); |
46
|
|
|
|
|
|
|
|
47
|
34
|
|
|
|
|
158
|
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
|
|
|
|
|
454
|
}); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
$stash->add_symbol('&zci_new', sub { |
64
|
34
|
|
|
34
|
|
118
|
shift; |
|
|
|
|
31
|
|
|
|
|
|
|
|
3
|
|
|
|
65
|
34
|
50
|
|
|
|
659
|
DDG::ZeroClickInfo->new( %zci_params, ref $_[0] eq 'HASH' ? %{$_[0]} : @_ ); |
|
0
|
|
|
|
|
|
|
66
|
34
|
|
|
|
|
331
|
}); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |