Dpkg::Compression(3perl)
β¨ Dpkg::Compression(3perl) β the libdpkg-perl era π
Okay bestie, so this is a Perl module from the libdpkg-perl world, and honestly? It's giving tiny little database of compression methods and it's lowkey iconic for it. π
πΈ NAME πΈ
Dpkg::Compression β a simple database of available compression methods. That's the whole vibe. It's your group chat for gzip, bzip2, xz, lzma and friends. π
π¦ DESCRIPTION π¦
This module provides a few public functions and a public regex so you can interact with the whole set of supported compression methods. That's it, that's the module. No cap. β¨
π FUNCTIONS π
Here's the full roster, bestie. Everyone gets a bullet. Nobody gets left behind. π«Ά
@list = compression_get_list()β Returns a list of supported compression methods, sorted alphabetically so it's all neat and aesthetic. π$bool = compression_is_supported($comp)β Returns a boolean telling you whether the given compression method is known and supported. Basically a vibe check for compressors. β$comp = compression_guess_from_filename($filename)β Returns the compression method that is likely used on$filename, figured out from its file extension. Detective mode. π΅οΈββοΈ$regex = compression_get_file_extension_regex()β Returns a regex that matches the file extension of a file compressed with one of the supported compression methods. One regex to match them all, literally. π₯$ext = compression_get_file_extension($comp)β Returns the file extension for the compressor$comp. Simple, clean, slay. π$comp = compression_get_default()β Returns the default compression method. It's"xz"unlesscompression_set_default()has been used to change it. xz is the main character here, periodt. πcompression_set_default($comp)β Changes the default compression method. Errors out if the given compression method is not supported, so don't try it with nonsense. π$level = compression_get_default_level()β Returns the global default compression level used when compressing data if it has been set; otherwise it gives you the default level for the default compressor.
And the numbers, bestie: it's "9" for "gzip" and "bzip2", and "6" for "xz" and "lzma" β unless compression_set_default_level() has been used to change it. π’
compression_set_default_level($level)β Changes the global default compression level. Passing undef as the level will reset it to the global default compressor specific default; otherwise it errors out if the level is not valid (checkcompression_is_valid_level()). π§$level = compression_get_level($comp)β Returns the compression level used when compressing data with a specific compressor. What comes back is the specific compression level if one has been set; otherwise the global default compression level if one has been set; otherwise it falls back to the specific default compression level. Three-tier priority, very hierarchical, very demure. πΈcompression_set_level($comp, $level)β Changes the compression level for a specific compressor. Passing undef as the level will reset it to the specific default compressor level; otherwise it errors out if the level is not valid (seecompression_is_valid_level()). π$bool = compression_is_valid_level($level)β Returns a boolean telling you whether$levelis a valid compression level. To be valid it must be either a number between1and9, or"fast", or"best". That's the whole dress code. π$threads = compression_get_threads()β Returns the number of threads to use for compression and decompression. Multithreading era. β‘compression_set_threads($threads)β Changes the threads to use for compression and decompression. Passing"undef"or0requests automatic mode, based on the current CPU cores on the system. Let the machine decide, honestly. π@exec = compression_get_cmdline_compress($comp)β Returns a list ready to be passed toexec(). Its first element is the program name for compression, and the following elements are parameters for the program.
When executed, the program will act as a filter between its standard input and its standard output. Pipe queen. π«Ά
@exec = compression_get_cmdline_decompress($comp)β Returns a list ready to be passed toexec(). Its first element is the program name for decompression, and the following elements are parameters for the program.
When executed, the program will act as a filter between its standard input and its standard output. Same energy, opposite direction. π
π CHANGES π
The lore. The history. The glow-up timeline. β
π Version 3.00 (dpkg 1.23.6)
- Remove function:
compression_get_property(). Gone. Not invited to the party anymore. π
π¦ Version 2.01 (dpkg 1.21.14)
- New functions:
compression_get_file_extension(),compression_get_level(),compression_set_level(),compression_get_cmdline_compress(),compression_get_cmdline_decompress(),compression_get_threads()andcompression_set_threads(). - Deprecated functions:
compression_get_property(). We all saw this coming. π
π Version 2.00 (dpkg 1.20.0)
- Hide variables:
$default_compression,$default_compression_leveland$compression_re_file_ext. They're private now, mind your business. π
β¨ Version 1.02 (dpkg 1.17.2)
- New function:
compression_get_file_extension_regex() - Deprecated variables:
$default_compression,$default_compression_leveland$compression_re_file_ext
πΈ Version 1.01 (dpkg 1.16.1)
- Default compression level is not global any more β it is per compressor type. Big structural change, we love growth. π¦
π Version 1.00 (dpkg 1.15.6)
- Mark the module as public. Coming out party, iconic. π
Heads up bestie:compression_set_default(),compression_set_default_level()andcompression_set_level()all error out on bad input. So do your vibe check first. No guessing. π
And that's the page! π This gem comes from the libdpkg-perl source, version 1.23.11-dirty, dated 2026-09-09 β signed off with love, glitter, and a little bit of xz at level 6. πβ¨π
π¦ where this page comes from
- arch rolling: dpkg 1.23.11-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms