Acme-Perl-Consensual
view release on metacpan or search on metacpan
inc/Module/Install/Package.pm view on Meta::CPAN
...
}
# Find and load the author side plugin:
sub _load_plugin {
my ($self, $spec, $namespace) = @_;
$spec ||= '';
$namespace ||= 'Module::Package';
my $version = '';
$Module::Package::plugin_version = 0;
if ($spec =~ s/\s+(\S+)\s*//) {
$version = $1;
$Module::Package::plugin_version = $version;
}
my ($module, $plugin) =
not($spec) ? ('Plugin', "Plugin::basic") :
($spec =~ /^\w(\w|::)*$/) ? ($spec, $spec) :
($spec =~ /^:(\w+)$/) ? ('Plugin', "Plugin::$1") :
($spec =~ /^(\S*\w):(\w+)$/) ? ($1, "$1::$2") :
die "$spec is invalid";
$module = "${namespace}::${module}";
$plugin = "${namespace}::${plugin}";
eval "use $module $version (); 1" or die $@;
return $plugin->new();
}
# Find and load the user side plugin:
sub _load_dist_plugin {
my ($self, $spec, $namespace) = @_;
$spec ||= '';
$namespace ||= 'Module::Package::Dist';
my $r = eval { $self->_load_plugin($spec, $namespace); };
return $r if ref $r;
return;
}
#-----------------------------------------------------------------------------#
# These are the user side analogs to the author side plugin API calls.
# Prefix with '_' to not pollute Module::Install plugin space.
#-----------------------------------------------------------------------------#
sub _initial {
my ($self) = @_;
}
sub _main {
my ($self) = @_;
}
# NOTE These must match Module::Package::Plugin::final.
sub _final {
my ($self) = @_;
$self->_all_from;
$self->_requires_from;
$self->_install_bin;
$self->_install_share;
$self->_WriteAll;
}
#-----------------------------------------------------------------------------#
# This section is where all the useful code bits go. These bits are needed by
# both Author and User side runs.
#-----------------------------------------------------------------------------#
my $all_from = 0;
sub _all_from {
my $self = shift;
return if $all_from++;
return if $self->name;
my $file = shift || "$main::PM" or die "all_from has no file";
$self->all_from($file);
}
my $requires_from = 0;
sub _requires_from {
my $self = shift;
return if $requires_from++;
return unless $self->package_options->{requires_from};
my $file = shift || "$main::PM" or die "requires_from has no file";
$self->requires_from($main::PM)
}
my $install_bin = 0;
sub _install_bin {
my $self = shift;
return if $install_bin++;
return unless $self->package_options->{install_bin};
return unless -d 'bin';
my @bin;
File::Find::find(sub {
return unless -f $_;
push @bin, $File::Find::name;
}, 'bin');
$self->install_script($_) for @bin;
}
my $install_share = 0;
sub _install_share {
my $self = shift;
return if $install_share++;
return unless $self->package_options->{install_share};
return unless -d 'share';
$self->install_share;
}
my $WriteAll = 0;
sub _WriteAll {
my $self = shift;
return if $WriteAll++;
$self->WriteAll(@_);
}
# Base package for Module::Package plugin distributed components.
package Module::Package::Dist;
sub new {
my ($class, %args) = @_;
bless \%args, $class;
}
sub mi {
( run in 0.628 second using v1.01-cache-2.11-cpan-39bf76dae61 )