Archiv...::Lite(3pm)

πŸŽ€ NAME πŸŽ€

Archive::Any::Lite β€” it's a simple CPAN package extractor, bestie πŸ’– (yes this is the Archiv...::Lite(3pm) page, the manual name got trimmed cute in the header but we know her πŸ’…)


✨ SYNOPSIS ✨

use strict;
use warnings;
use Archive::Any::Lite;

local $Archive::Any::Lite::IGNORE_SYMLINK = 1; # for safety

my $tarball = 'foo.tar.gz';
my $archive = Archive::Any::Lite->new($tarball);
$archive->extract('into/some/directory/');

look at that, it literally just works 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so first thing: this is a fork of Archive::Any, written by Michael Schwern and Clint Moore. so like, the origin story is real.

The main difference? This one works properly even when you fork() β€” not me being dramatic, that's the whole flex β€” and it may need less memory to extract a tarball. slay.

On the other hand, lowkey there's some tradeoffs, no cap:

  • it isn't pluggable β€” the only file formats it supports are the ones used in the CPAN toolchains, that's it, that's the list
  • it doesn't check mime types (at least as of this writing, okay, at least as of this writing πŸ™ˆ)

πŸ‘‘ METHODS πŸ‘‘

🌸 new

my $archive = Archive::Any::Lite->new($archive_file);
my $archive = Archive::Any::Lite->new($archive_file, {tar_filter => qr/foo/});

creates an object, periodt. and if you're feeling fancy you can pass an optional hash reference for finer control πŸŽ€

🌸 extract

$archive->extract;
$archive->extract($directory);
$archive->extract($directory, {tar_filter => qr/foo/});

extracts the files in the archive into the given $directory. and if you don't hand it a $directory? it just goes into the current working directory. (main character energy, honestly πŸ’…)

you can also pass an optional hash reference for finer control. but listen β€” if you pass it, the options you passed in "new" get ignored. like, fully ignored. so pick your lane 🫢

🌸 files

my @file = $archive->files;

gives you a list of files in the archive. that's it. iconic. ✨

🌸 is_impolite

my $is_impolite = $archive->is_impolite;

checks whether this archive is gonna unpack into the current directory instead of creating its own lil folder. rude of it, honestly. πŸ’€

🌸 is_naughty

my $is_naughty = $archive->is_naughty;

checks whether this archive is gonna unpack outside the current directory. that's the naughty one. keep an eye on her 😭

🌸 type

deprecated. it's here for backward compatibility only, bestie, so like... don't build anything new on it πŸ’…


🫢 GLOBAL VARIABLE 🫢

if you set it to true, then symlinks (and hardlinks, for tarball) will be ignored.

fr fr, the SYNOPSIS sets this to 1 for safety and honestly? listen to the SYNOPSIS.

🌈 SEE ALSO 🌈

  • Archive::Any
  • Archive::Tar::Streamed

πŸ’– AUTHOR πŸ’–

Archive::Any is written by Michael G Schwern and Clint Moore. πŸ‘‘

and Kenichi Ishigaki, <ishigaki@cpan.org> β€” that's the one who forked her into existence πŸ¦‹


Copyright (C) 2012 by Kenichi Ishigaki.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. 🌸


okay that's the whole page!! and for the lil sign-off β€” this was the perl v5.36.0 build of the doc, dated 2022-10-13, from the Archiv...::Lite(3pm) page. go extract something cute, stay safe out there, and set your $IGNORE_SYMLINK πŸ’…βœ¨πŸ’–

πŸ“¦ where this page comes from