File Coverage

blib/lib/ExtUtils/Builder/CPAN/Tool.pm
Criterion Covered Total %
statement 11 51 21.5
branch 0 2 0.0
condition n/a
subroutine 4 16 25.0
pod 0 1 0.0
total 15 70 21.4


line stmt bran cond sub pod time code
1             package ExtUtils::Builder::CPAN::Tool;
2             $ExtUtils::Builder::CPAN::Tool::VERSION = '0.020';
3 1     1   169839 use 5.010;
  1         2  
4 1     1   4 use strict;
  1         2  
  1         23  
5 1     1   3 use warnings;
  1         1  
  1         78  
6              
7 1     1   6 use parent 'ExtUtils::Builder::Planner::Extension';
  1         3  
  1         6  
8              
9             sub add_methods {
10 0     0 0   my (undef, $planner, %args) = @_;
11              
12             $planner->add_delegate('config', sub {
13 0     0     require ExtUtils::Config;
14 0           state $config = ExtUtils::Config->new;
15 0           });
16              
17             $planner->add_delegate('meta', sub {
18 0     0     require CPAN::Meta;
19 0           state $meta = CPAN::Meta->load_file('META.json');
20 0           });
21              
22             $planner->add_delegate('distribution', sub {
23 0     0     return $_[0]->meta->name;
24 0           });
25             $planner->add_delegate('version', sub {
26 0     0     return version->new($_[0]->meta->version);
27 0           });
28              
29             $planner->add_delegate('main_module', sub {
30 0     0     state $main_module = do {
31 0           my $distribution = $_[0]->distribution;
32 0           $distribution =~ s/-/::/g;
33 0           $distribution;
34             };
35 0           });
36              
37             $planner->add_delegate('perl_path', sub {
38 0     0     require ExtUtils::Builder::Util;
39 0           state $path = ExtUtils::Builder::Util::get_perl(config => $_[0]->config);
40 0           });
41              
42 0     0     $planner->add_delegate($_, sub { !!0 }) for qw/verbose uninst pureperl_only/;
  0            
43 0     0     $planner->add_delegate('jobs', sub { 1 });
  0            
44              
45             $planner->add_delegate('is_os', sub {
46 0     0     my ($self, @wanted) = @_;
47 0           return not not grep { $_ eq $^O } @wanted
  0            
48 0           });
49             $planner->add_delegate('is_os_type', sub {
50 0     0     my ($self, $wanted) = @_;
51 0           require Perl::OSType;
52 0           return Perl::OSType::is_os_type($wanted);
53 0           });
54              
55             $planner->add_delegate('new_planner', sub {
56 0     0     my ($self, %options) = @_;
57 0           my $config = $self->config;
58 0 0         $config = $config->but($options{but}) if $options{but};
59 0           require ExtUtils::Builder::Planner;
60 0           my $inner = ExtUtils::Builder::Planner->new;
61 0           $inner->add_delegate('config', sub { $config });
  0            
62 0           return $inner;
63 0           });
64             }
65              
66             1;
67              
68             # ABSTRACT: A base implementation for CPAN build scripts.
69              
70             __END__