line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DDG::Meta::Block; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:DDG'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Inject keywords to make a L plugin |
4
|
|
|
|
|
|
|
$DDG::Meta::Block::VERSION = '1017'; |
5
|
11
|
|
|
11
|
|
66
|
use strict; |
|
11
|
|
|
|
|
25
|
|
|
11
|
|
|
|
|
274
|
|
6
|
11
|
|
|
11
|
|
53
|
use warnings; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
227
|
|
7
|
11
|
|
|
11
|
|
59
|
use Carp; |
|
11
|
|
|
|
|
26
|
|
|
11
|
|
|
|
|
468
|
|
8
|
11
|
|
|
11
|
|
3887
|
use DDG::Block::Blockable::Triggers; |
|
11
|
|
|
|
|
32
|
|
|
11
|
|
|
|
|
309
|
|
9
|
11
|
|
|
11
|
|
73
|
use Package::Stash; |
|
11
|
|
|
|
|
22
|
|
|
11
|
|
|
|
|
1858
|
|
10
|
|
|
|
|
|
|
require Moo::Role; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my %applied; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub apply_keywords { |
16
|
35
|
|
|
35
|
1
|
98
|
my ( $class, $target ) = @_; |
17
|
|
|
|
|
|
|
|
18
|
35
|
50
|
|
|
|
121
|
return if exists $applied{$target}; |
19
|
35
|
|
|
|
|
85
|
$applied{$target} = undef; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# |
22
|
|
|
|
|
|
|
# triggers |
23
|
|
|
|
|
|
|
# |
24
|
|
|
|
|
|
|
|
25
|
35
|
|
|
|
|
82
|
my $triggers; |
26
|
35
|
|
|
|
|
309
|
my $stash = Package::Stash->new($target); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
35
|
|
|
33
|
|
445
|
$stash->add_symbol('&triggers_block_type',sub { $triggers->block_type }); |
|
33
|
|
|
|
|
404
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
35
|
|
|
35
|
|
265
|
$stash->add_symbol('&get_triggers',sub { $triggers->get }); |
|
35
|
|
|
|
|
6696
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
35
|
100
|
|
27
|
|
263
|
$stash->add_symbol('&has_triggers',sub { $triggers ? 1 : 0 }); |
|
27
|
|
|
20
|
|
199
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
$stash->add_symbol('&triggers',sub { |
39
|
47
|
100
|
|
47
|
|
862
|
$triggers = DDG::Block::Blockable::Triggers->new unless $triggers; |
40
|
47
|
|
|
|
|
156
|
$triggers->add(@_) |
41
|
35
|
|
|
|
|
266
|
}); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# |
44
|
|
|
|
|
|
|
# apply role |
45
|
|
|
|
|
|
|
# |
46
|
|
|
|
|
|
|
|
47
|
35
|
|
|
|
|
243
|
Moo::Role->apply_role_to_package($target,'DDG::Block::Blockable'); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
__END__ |