Perl-Dist-WiX
view release on metacpan or search on metacpan
lib/Perl/Dist/WiX/Asset/PAR.pm view on Meta::CPAN
of identification in output. A sensible default would be the name of
the primary Perl module in the package.
=cut
has name => (
is => 'ro',
isa => Str,
reader => 'get_name',
required => 1,
);
=head3 dist_info
The required C<dist_info> parameter is the location of the source package
for the .par file, either as a URL (which should be accessible for 3 years)
or as a location on CPAN in the 'AUTHORID/dist-version.tar.gz' format.
=cut
has dist_info => (
is => 'ro',
isa => 'Str',
reader => '_get_dist_info',
required => 1,
);
=head2 install
The C<install> method retrieves the specified .par file and installs it.
=cut
sub install {
my $self = shift;
my $name = $self->get_name();
my $image_dir = $self->_get_image_dir();
my $download_dir = $self->_get_download_dir();
my $url = $self->_get_url();
my $vendor =
!$self->_get_parent()->portable() ? 1
: ( $self->_get_parent()->perl_major_version() >= 12 ) ? 1
: 0;
$self->_trace_line( 1, "Preparing $name\n" );
my $output;
my $io = IO::String->new($output);
my $packlist;
# When $saved goes out of scope, STDOUT will be restored.
{
my $saved = SelectSaver->new($io);
# Download the file.
# Do it here for consistency instead of letting PAR::Dist do it
my $file = $self->_mirror( $url, $download_dir, );
# Set the appropriate installation paths
my @module_dirs = split m{::}ms, $name;
my $perldir = catdir( $image_dir, 'perl' );
my $libdir = catdir( $perldir, 'vendor', 'lib' );
my $bindir = catdir( $perldir, 'bin' );
my $cdir = catdir( $image_dir, 'c' );
if ( not $vendor ) {
$libdir = catdir( $perldir, 'site', 'lib' );
}
$packlist = catfile( $libdir, 'auto', @module_dirs, '.packlist' );
# Suppress warnings for resources that don't exist
local $WARNING = 0;
# Install
PAR::Dist::install_par(
dist => $file,
packlist_read => $packlist,
packlist_write => $packlist,
inst_lib => $libdir,
inst_archlib => $libdir,
inst_bin => $bindir,
inst_script => $bindir,
inst_man1dir => undef, # no man pages
inst_man3dir => undef, # no man pages
custom_targets => {
'blib/c/lib' => catdir( $cdir, 'lib' ),
'blib/c/bin' => catdir( $cdir, 'bin' ),
'blib/c/include' => catdir( $cdir, 'include' ),
'blib/c/share' => catdir( $cdir, 'share' ),
},
);
}
# Print saved output if required.
$io->close;
$self->_trace_line( 2, $output );
# Get distribution name to add to what's installed.
$self->_add_to_distributions_installed( $self->_get_dist_info() );
# Read in the .packlist and return it.
my $filelist =
File::List::Object->new->load_file($packlist)
->filter( $self->_filters )->add_file($packlist);
return $filelist;
} ## end sub install
no Moose;
__PACKAGE__->meta->make_immutable;
1;
__END__
=head1 PAR FILE FORMAT EXTENSIONS
This concerns packagers of .par binaries only.
A .par usually mostly contains the blib/ directory after making a Perl module.
( run in 0.465 second using v1.01-cache-2.11-cpan-71847e10f99 )