Alien-Win32-LZMA
view release on metacpan or search on metacpan
lib/Alien/Win32/LZMA.pm view on Meta::CPAN
package Alien::Win32::LZMA;
=pod
=head1 NAME
Alien::Win32::LZMA - Install and make available lzma.exe
=head1 DESCRIPTION
On Windows (unlike on Unix systems) the primary mechanism for accessing
LZMA functionality is via the 7-Zip desktop application.
B<Alien::Win32::LZMA> is a simple Alien module which embeds a copy
of the F<lzma.exe> command line utility for use in situations where
the memory-only compression and decompression provided by the current
generation of modules is not sufficient.
The version of lzma.exe provided by this module is taken from the LZMA
SDK 4.65 at L<http://downloads.sourceforge.net/sevenzip/lzma465.tar.bz2>.
=head1 FUNCTIONS
=cut
use 5.008;
use strict;
use warnings;
use Carp ();
use Exporter ();
use IPC::Run3 0.042 ();
use File::ShareDir 1.00 ();
our $VERSION = '4.66';
our @ISA = 'Exporter';
=pod
=head2 lzma_exe
The C<lzma_exe> function returns the location of the installed
F<lzma.exe> command line application as a string.
=cut
sub lzma_exe {
File::ShareDir::dist_file('Alien-Win32-LZMA', 'lzma.exe');
}
=pod
=head2 lzma_version
The C<lzma_version> function runs F<lzma.exe> and finds the version
of the application. It should match the version of this module.
=cut
sub lzma_version {
my $exe = lzma_exe();
my $stderr = '';
my $result = IPC::Run3::run3(
[ $exe ],
\undef,
\undef,
\$stderr,
);
unless ( $result ) {
die "$exe execution failed";
}
unless ( $stderr =~ /^\s*LZMA\s*([\d\.]+)/s ) {
die "Failed to find LZMA version";
( run in 0.723 second using v1.01-cache-2.11-cpan-39bf76dae61 )