File Coverage

lib/CPAN/Plugin.pm
Criterion Covered Total %
statement 9 33 27.2
branch 0 12 0.0
condition n/a
subroutine 3 10 30.0
pod 6 7 85.7
total 18 62 29.0


line stmt bran cond sub pod time code
1             package CPAN::Plugin;
2              
3 1     1   3296 use strict;
  1         2  
  1         28  
4 1     1   4 use warnings;
  1         1  
  1         109  
5              
6             our $VERSION = '0.96';
7              
8             require CPAN;
9              
10             ######################################################################
11              
12             sub new { # ;
13 0     0 0   my ($class, %params) = @_;
14              
15 0 0         my $self = +{
16             (ref $class ? (%$class) : ()),
17             %params,
18             };
19              
20 0 0         $self = bless $self, ref $class ? ref $class : $class;
21              
22 0 0         unless (ref $class) {
23 0           local $_;
24 1     1   4 no warnings 'once';
  1         1  
  1         407  
25 0           $CPAN::META->use_inst ($_) for $self->plugin_requires;
26             }
27              
28 0           $self;
29             }
30              
31             ######################################################################
32       0 1   sub plugin_requires { # ;
33             }
34              
35             ######################################################################
36             sub distribution_object { # ;
37 0     0 1   my ($self) = @_;
38 0           $self->{distribution_object};
39             }
40              
41             ######################################################################
42             sub distribution { # ;
43 0     0 1   my ($self) = @_;
44              
45 0           my $distribution = $self->distribution_object->id;
46 0 0         CPAN::Shell->expand("Distribution",$distribution)
47             or $self->frontend->mydie("Unknowns distribution '$distribution'\n");
48             }
49              
50             ######################################################################
51             sub distribution_info { # ;
52 0     0 1   my ($self) = @_;
53              
54 0           CPAN::DistnameInfo->new ($self->distribution->id);
55             }
56              
57             ######################################################################
58             sub build_dir { # ;
59 0     0 1   my ($self) = @_;
60              
61             my $build_dir = $self->distribution->{build_dir}
62 0 0         or $self->frontend->mydie("Distribution has not been built yet, cannot proceed");
63             }
64              
65             ######################################################################
66             sub is_xs { #
67 0     0 1   my ($self) = @_;
68              
69 0           my @xs = glob File::Spec->catfile ($self->build_dir, '*.xs'); # quick try
70              
71 0 0         unless (@xs) {
72 0           require ExtUtils::Manifest;
73 0           my $manifest_file = File::Spec->catfile ($self->build_dir, "MANIFEST");
74 0           my $manifest = ExtUtils::Manifest::maniread($manifest_file);
75 0           @xs = grep /\.xs$/, keys %$manifest;
76             }
77              
78 0           scalar @xs;
79             }
80              
81             ######################################################################
82              
83             package CPAN::Plugin;
84              
85             1;
86              
87             __END__