README
1NAME
2 Archive::Extract::Libarchive - A generic archive extracting mechanism
3 (using libarchive)
4
5SYNOPSIS
6 use Archive::Extract::Libarchive;
7
8 # build an Archive::Extract object
9 my $ae = Archive::Extract::Libarchive->new( archive => 'foo.tgz' );
10
11 # extract to cwd()
12 my $ok = $ae->extract;
13
14 # extract to /tmp
15 my $ok = $ae->extract( to => '/tmp' );
16
17 # what if something went wrong?
18 my $ok = $ae->extract or die $ae->error;
19
20 # files from the archive
21 my $files = $ae->files;
22
23 # dir that was extracted to
24 my $outdir = $ae->extract_path;
25
26 # absolute path to the archive you provided
27 $ae->archive;
28
29DESCRIPTION
30 Archive::Extract is a generic archive extraction mechanism. This module
31 has a similar interface to Archive::Extract, but instead of using Perl
32 modules and external commands, it uses the libarchive C libary
33 (<http://code.google.com/p/libarchive/>), which you must have installed
34 (libarchive-dev package for Debian/Ubuntu). It supports many different
35 archive formats and compression algorithms and is fast.
36
37 For example, unpacking the whole of CPAN using this module is about ten
38 times faster than using Archive::Extract.
39
40METHODS
41 $ae = Archive::Extract::Libarchive->new(archive => '/path/to/archive')
42 Creates a new "Archive::Extract::Libarchive" object based on the archive
43 file you passed it.
44
45 $ae->extract( [to => '/output/path'] )
46 Extracts the archive represented by the "Archive::Extract::Libarchive"
47 object to the path of your choice as specified by the "to" argument.
48 Defaults to "cwd()".
49
50 It will return true on success, and false on failure.
51
52 On success, it will also set the follow attributes in the object:
53
54 $ae->extract_path
55 This is the directory that the files where extracted to.
56
57 $ae->files
58 This is an array ref with the paths of all the files in the archive,
59 relative to the "to" argument you specified. To get the full path to
60 an extracted file, you would use:
61
62 File::Spec->catfile( $to, $ae->files->[0] );
63
64ACCESSORS
65 $ae->error()
66 Returns the last encountered error as string.
67
68 $ae->extract_path
69 This is the directory the archive got extracted to. See "extract()" for
70 details.
71
72 $ae->files
73 This is an array ref holding all the paths from the archive. See
74 "extract()" for details.
75
76 $ae->archive
77 This is the full path to the archive file represented by this
78 "Archive::Extract::Libarchive" object.
79
80AUTHOR
81 Leon Brocard <acme@astray.com>
82
83COPYRIGHT
84 Copyright (C) 2011, Leon Brocard.
85
86LICENSE
87 This module is free software; you can redistribute it or modify it under
88 the same terms as Perl itself.
89
90