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 = '1016'; |
5
|
11
|
|
|
11
|
|
37
|
use strict; |
|
11
|
|
|
|
|
15
|
|
|
11
|
|
|
|
|
251
|
|
6
|
11
|
|
|
11
|
|
33
|
use warnings; |
|
11
|
|
|
|
|
14
|
|
|
11
|
|
|
|
|
190
|
|
7
|
11
|
|
|
11
|
|
37
|
use Carp; |
|
11
|
|
|
|
|
8
|
|
|
11
|
|
|
|
|
468
|
|
8
|
11
|
|
|
11
|
|
2133
|
use DDG::ZeroClickInfo; |
|
11
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
261
|
|
9
|
11
|
|
|
11
|
|
45
|
use Package::Stash; |
|
11
|
|
|
|
|
16
|
|
|
11
|
|
|
|
|
2913
|
|
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
|
49
|
my ( $class, $target ) = @_; |
36
|
|
|
|
|
|
|
|
37
|
34
|
50
|
|
|
|
127
|
return if exists $applied{$target}; |
38
|
34
|
|
|
|
|
68
|
$applied{$target} = undef; |
39
|
|
|
|
|
|
|
|
40
|
34
|
|
|
|
|
127
|
my @parts = split('::',$target); |
41
|
34
|
|
|
|
|
46
|
shift @parts; |
42
|
34
|
|
|
|
|
47
|
shift @parts; |
43
|
34
|
|
|
|
|
95
|
my $answer_type = lc(join(' ',@parts)); |
44
|
|
|
|
|
|
|
|
45
|
34
|
|
|
|
|
345
|
my $stash = Package::Stash->new($target); |
46
|
|
|
|
|
|
|
|
47
|
34
|
|
|
|
|
128
|
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
|
|
|
|
|
425
|
}); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
$stash->add_symbol('&zci_new', sub { |
64
|
34
|
|
|
34
|
|
147
|
shift; |
|
|
|
|
31
|
|
|
|
|
|
|
|
3
|
|
|
|
65
|
34
|
50
|
|
|
|
604
|
DDG::ZeroClickInfo->new( %zci_params, ref $_[0] eq 'HASH' ? %{$_[0]} : @_ ); |
|
0
|
|
|
|
|
|
|
66
|
34
|
|
|
|
|
319
|
}); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
__END__ |