10 ######################################################################
13 my ($class, %params) = @_;
16 (ref $class ? (%$class) : ()),
20 $self = bless $self, ref $class ? ref $class : $class;
25 $CPAN::META->use_inst ($_) for $self->plugin_requires;
31 ######################################################################
32 sub plugin_requires { # ;
35 ######################################################################
36 sub distribution_object { # ;
38 $self->{distribution_object};
41 ######################################################################
42 sub distribution { # ;
45 my $distribution = $self->distribution_object->id;
46 CPAN::Shell->expand("Distribution",$distribution)
47 or $self->frontend->mydie("Unknowns distribution '$distribution'\n");
50 ######################################################################
51 sub distribution_info { # ;
54 CPAN::DistnameInfo->new ($self->distribution->id);
57 ######################################################################
61 my $build_dir = $self->distribution->{build_dir}
62 or $self->frontend->mydie("Distribution has not been built yet, cannot proceed");
65 ######################################################################
69 my @xs = glob File::Spec->catfile ($self->build_dir, '*.xs'); # quick try
72 require ExtUtils::Manifest;
73 my $manifest_file = File::Spec->catfile ($self->build_dir, "MANIFEST");
74 my $manifest = ExtUtils::Manifest::maniread($manifest_file);
75 @xs = grep /\.xs$/, keys %$manifest;
81 ######################################################################
93 CPAN::Plugin - Base class for CPAN shell extensions
97 package CPAN::Plugin::Flurb;
98 use parent 'CPAN::Plugin';
101 my ($self, $distribution_object) = @_;
102 $self = $self->new (distribution_object => $distribution_object);
110 The plugin system in the CPAN shell was introduced in version 2.07 and
111 is still considered experimental.
113 =head2 How Plugins work?
115 See L<CPAN/"Plugin support">.
119 =head2 plugin_requires
121 returns list of packages given plugin requires for functionality.
122 This list is evaluated using C<CPAN->use_inst> method.
124 =head2 distribution_object
126 Get current distribution object.
130 =head2 distribution_info
134 Simple delegatees for misc parameters derived from distribution
138 Predicate to detect whether package contains XS.
142 Branislav Zahradnik <barney@cpan.org>