File Coverage

blib/lib/Ark/Plugin.pm
Criterion Covered Total %
statement 22 29 75.8
branch 0 2 0.0
condition n/a
subroutine 6 10 60.0
pod n/a
total 28 41 68.2


line stmt bran cond sub pod time code
1             package Ark::Plugin;
2 59     143   103621 use Mouse::Role;
  59         33784  
  59         552  
3 59     59   21487 use Mouse::Exporter;
  59         142  
  59         420  
4              
5             do {
6             my %EXPORTS;
7              
8             sub import {
9 98     98   302 my ($class, $context) = @_;
10              
11 98         1141 require utf8; utf8->import;
  98         517  
12              
13 98         492 my $caller = caller;
14 98         472 Mouse::Meta::Role->initialize($caller);
15              
16 98         2780 my ($import, $unimport) = Mouse::Exporter->build_import_methods(
17             exporting_package => $caller,
18             also => "Mouse::Role",
19             );
20 98         25250 $EXPORTS{$caller} = $unimport;
21              
22 98         471 $caller->$import({ into => $caller });
23              
24 59     59   9034 no strict 'refs';
  59         125  
  59         12746  
25 98     138   21575 *{ $caller . '::plugin_context' } = sub { $context };
  98     138   599  
  138         546  
26 98         14057 *{ $caller . '::method' } = sub {
27 0     0     my ($self, $method) = @_;
        0      
28 0           my $caller = caller;
29 0 0         my $sub = $caller->can($method) or die qq/No such method "$method" on $caller/;
30              
31 0     0     return sub { $sub->($self, @_) };
  0            
32 98         391 };
33             }
34              
35             sub unimport {
36 0     0     goto \&{ $EXPORTS{ scalar caller } };
  0            
37             }
38             };
39              
40             1;