CPANPL...xtract(3pm)

πŸ“¦
version 0.9916 Β· 5 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– CPANPLUS::Internals::Extract πŸ’–

okay bestie so this is CPANPLUS::Internals::Extract β€” the internals girlie for archive extraction, living her best life in the User Contributed Perl Documentation section. she's a 3pm page, she's internal, and she is so good at her job. πŸŽ€


✨ NAME ✨

CPANPLUS::Internals::Extract β€” the internals for archive extraction, no cap πŸ¦‹


🌸 SYNOPSIS 🌸

### for source files ###
$self->_gunzip( file => 'foo.gz', output => 'blah.txt' );

### for modules/packages ###
$dir = $self->_extract( module      => $modobj,
                        extractdir  => '/some/where' );

like, that's the whole vibe. two modes, both iconic. πŸ’…


🫢 DESCRIPTION 🫢

CPANPLUS::Internals::Extract extracts compressed files for CPANPLUS. she can do this either with a pure perl solution β€” which is the preferred one, periodt β€” using Archive::Tar and Compress::Zlib, or with binaries, like gzip and tar. so you've got options, bestie, and she's not gonna judge you for picking either. 😌

the flow looks like this:

$cb->_extract
    Delegate to Archive::Extract

like literally that's it, she just hands it off. delegation queen. πŸ‘‘


πŸ’… METHODS πŸ’…

$dir = _extract( module => $modobj, [perl => '/path/to/perl', extractdir => '/path/to/extract/to', prefer_bin => BOOL, verbose => BOOL, force => BOOL] )

so _extract will take a module object and extract it to extractdir if that's provided, or to the default location, which is obtained from your config. she's flexible like that. 🧚

the file name is obtained by looking at $modobj->status->fetch, and then it gets parsed to see if it's a tar or a zip archive. detective work, honestly.

if it's a zip archive, __unzip will be called; otherwise __untar will be called. and in the unlikely event the file is of neither format, an error will be thrown. 😭 like she will not be guessing, she will be throwing hands (an error).

_extract takes the following options:

  • module β€” a CPANPLUS::Module object. this one is required, so don't come empty-handed. 🫢
  • extractdir β€” the directory to extract the archive to. by default this looks something like:
/CPANPLUS_BASE/PERL_VERSION/BUILD/MODULE_NAME
  • prefer_bin β€” a flag indicating whether you prefer a pure perl solution, ie Archive::Tar or Archive::Zip respectively, or a binary solution like unzip and tar. your choice, your era. ✨
  • perl β€” the path to the perl executable to use for any perl calls. also used to determine the build version directory for extraction. multitasking icon. πŸ’…
  • verbose β€” specifies whether to be verbose or not. defaults to your corresponding config entry.
  • force β€” specifies whether to force the extraction or not. defaults to your corresponding config entry. sometimes you just gotta make it happen, ngl. πŸ”₯

all other options are passed on verbatim to __unzip or __untar. no editing, no filtering, she just forwards them. πŸ’Œ

returns the directory the file was extracted to on success, and false on failure. success = path, failure = false, that's the whole contract, fr fr. ⭐


heads up bestie: this is an internals module, so it's the backstage crew, not the main character you usually call directly. but she's carrying the whole show, lowkey. 🌈

and that's the page!! πŸŽ€ this was perl v5.40.1, dated 2025-03-01, from the User Contributed Perl Documentation crew β€” mwah, obsessed, bye bestie πŸ’–βœ¨

πŸ“¦ where this page comes from