Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
devel:languages:perl:CPAN-C
perl-Compression-Util
perl-Compression-Util.spec
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File perl-Compression-Util.spec of Package perl-Compression-Util
# # spec file for package perl-Compression-Util # # Copyright (c) 2024 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via https://bugs.opensuse.org/ # %define cpan_name Compression-Util Name: perl-Compression-Util Version: 0.08 Release: 0 License: Artistic-2.0 Summary: Implementation of various techniques used in data compression URL: https://metacpan.org/release/%{cpan_name} Source0: https://cpan.metacpan.org/authors/id/T/TR/TRIZEN/%{cpan_name}-%{version}.tar.gz BuildArch: noarch BuildRequires: perl BuildRequires: perl-macros BuildRequires: perl(List::Util) >= 1.45 BuildRequires: perl(Module::Build) Requires: perl(List::Util) >= 1.45 %{perl_requires} %description *Compression::Util* is a function-based module, implementing various techniques used in data compression, such as: * Burrows-Wheeler transform * Move-to-front transform * Huffman Coding * Arithmetic Coding (in fixed bits) * Run-length encoding * Fibonacci coding * Elias gamma/omega coding * Delta coding * Bzip2-like compression * LZ77/LZSS compression * LZW compression The provided techniques can be easily combined in various ways to create powerful compressors, such as the Bzip2 compressor, which is a pipeline of the following methods: 1. Run-length encoding (RLE4) 2. Burrows-Wheeler transform (BWT) 3. Move-to-front transform (MTF) 4. Zero run-length encoding (ZRLE) 5. Huffman coding This functionality is provided by the function 'bwt_compress()', which can be explicitly implemented as: use 5.036; use Compression::Util qw(:all); my $data = do { open my $fh, '<:raw', $^X; local $/; <$fh> }; my $rle4 = rle4_encode(string2symbols($data)); my ($bwt, $idx) = bwt_encode(symbols2string($rle4)); my ($mtf, $alphabet) = mtf_encode(string2symbols($bwt)); my $rle = zrle_encode($mtf); my $enc = pack('N', $idx) . encode_alphabet($alphabet) . create_huffman_entry($rle); say "Original size : ", length($data); say "Compressed size: ", length($enc); # Decompress the result bwt_decompress($enc) eq $data or die "decompression error"; %prep %autosetup -n %{cpan_name}-%{version} find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -path "*/scripts/*" ! -name "configure" -print0 | xargs -0 chmod 644 %build perl Build.PL --installdirs=vendor ./Build build --flags=%{?_smp_mflags} %check ./Build test %install ./Build install --destdir=%{buildroot} --create_packlist=0 %perl_gen_filelist %files -f %{name}.files %doc Changes examples README.md %license LICENSE %changelog
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor