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" unless compression_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 (check compression_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 (see compression_is_valid_level()). πŸ™ˆ
  • $bool = compression_is_valid_level($level) β€” Returns a boolean telling you whether $level is a valid compression level. To be valid it must be either a number between 1 and 9, 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" or 0 requests 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 to exec(). 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 to exec(). 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() and compression_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_level and $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_level and $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() and compression_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