Archive-Libarchive
view release on metacpan or search on metacpan
lib/Archive/Libarchive/API.pm view on Meta::CPAN
my $int = $r->append_filter_program_signature($string, $opaque, $size_t);
=head2 close
# archive_read_close
my $int = $r->close;
=head2 extract
# archive_read_extract
my $int1 = $r->extract($e, $int2);
=head2 extract2
# archive_read_extract2
my $int = $r->extract2($e, $ar);
=head2 extract_set_skip_file
# archive_read_extract_set_skip_file
$r->extract_set_skip_file($sint64_1, $sint64_2);
=head2 format_capabilities
# archive_read_format_capabilities
my $int = $r->format_capabilities;
=head2 has_encrypted_entries
# archive_read_has_encrypted_entries
my $int = $r->has_encrypted_entries;
=head2 header_position
# archive_read_header_position
my $sint64 = $r->header_position;
=head2 new
# archive_read_new
my $r = Archive::Libarchive::ArchiveRead->new;
Create a new archive read object.
=head2 next_header
# archive_read_next_header
my $code = $r->next_header($e);
Returns the next L<Archive::Libarchive::Entry> object.
=head2 open
# archive_read_open1
# archive_read_set_callback_data
# archive_read_set_close_callback
# archive_read_set_open_callback
# archive_read_set_read_callback
# archive_read_set_seek_callback
# archive_read_set_skip_callback
$r->open(%callbacks);
This is a basic open method, which relies on callbacks for its implementation. The
only callback that is required is the C<read> callback. The C<open> and C<close>
callbacks are made available mostly for the benefit of the caller. The C<skip>
and C<seek> callbacks are used if available for some formats like C<zip> to improve
performance. All callbacks should return a L<normal status code|Archive::Libarchive/CONSTANTS>,
which is C<ARCHIVE_OK> on success.
Unlike the C<libarchive> C-API, this interface doesn't provide a facility for
passing in "client" data. In Perl this is implemented using a closure, which should
allow you to pass in arbitrary variables via proper scoping.
=over 4
=item open
$r->open(open => sub ($r) {
...
});
Called immediately when the archive is "opened";
=item read
$r->open(read => sub ($r, $ref) {
$$ref = ...;
...
return $size.
});
Called when new data is required. What is passed in is a scalar reference. You should
set this scalar to the next block of data. On success you should return the size of
the data in bytes, and on failure return a L<normal status code|Archive::Libarchive/CONSTANTS>.
=item seek
$r->open(seek => sub ($r, $offset, $whence) {
...
});
Called to seek to the new location. The C<$offset> and C<$whence> arguments work exactly
like the C<libc> C<fseek> function.
=item skip
$r->open(skip => sub ($r, $request) {
...
});
Called to skip the next C<$request> bytes. Should return the actual number of bytes skipped
on success (which can be less than or equal to C<$request>), and on failure return a
L<normal status code|Archive::Libarchive/CONSTANTS>.
=item close
$r->open(close => sub ($r) {
...
});
This is called when the archive instance is closed.
=back
=head2 open_FILE
$r->open_FILE($file_pointer);
lib/Archive/Libarchive/API.pm view on Meta::CPAN
=head2 add_filter_none
# archive_write_add_filter_none
my $int = $w->add_filter_none;
=head2 add_filter_program
# archive_write_add_filter_program
my $int = $w->add_filter_program($string);
=head2 add_filter_uuencode
# archive_write_add_filter_uuencode
my $int = $w->add_filter_uuencode;
=head2 add_filter_xz
# archive_write_add_filter_xz
my $int = $w->add_filter_xz;
=head2 add_filter_zstd
# archive_write_add_filter_zstd (optional)
my $int = $w->add_filter_zstd;
=head2 close
# archive_write_close
my $int = $w->close;
=head2 fail
# archive_write_fail
my $int = $w->fail;
=head2 finish_entry
# archive_write_finish_entry
my $int = $w->finish_entry;
=head2 get_bytes_in_last_block
# archive_write_get_bytes_in_last_block
my $int = $w->get_bytes_in_last_block;
=head2 get_bytes_per_block
# archive_write_get_bytes_per_block
my $int = $w->get_bytes_per_block;
=head2 new
# archive_write_new
my $w = Archive::Libarchive::ArchiveWrite->new;
Create a new archive write object.
=head2 open
# archive_write_open
$w->open(%callbacks);
This is a basic open method, which relies on callbacks for its implementation. The
only callback that is required is the C<write> callback. The C<open> and C<close>
callbacks are made available mostly for the benefit of the caller. All callbacks
should return a L<normal status code|Archive::Libarchive/CONSTANTS>, which is
C<ARCHIVE_OK> on success.
Unlike the C<libarchive> C-API, this interface doesn't provide a facility for
passing in "client" data. In Perl this is implemented using a closure, which should
allow you to pass in arbitrary variables via proper scoping.
=over 4
=item open
$w->open(open => sub ($w) {
...
});
Called immediately when the archive is "opened";
=item write
$w->open(write => sub ($w, $ref) {
... = $$ref;
return $size;
});
This callback is called when data needs to be written to the archive. It is passed in
as a reference to a scalar that contains the raw data. On success you should return the actual size of
the data written in bytes, and on failure return a L<normal status code|Archive::Libarchive/CONSTANTS>.
=item close
$w->open(open => sub ($w) {
...
});
This is called when the archive instance is closed.
=back
=head2 open_FILE
# archive_write_open_FILE
$w->open_FILE($file_pointer);
This takes either a L<FFI::C::File>, or an opaque pointer to a libc file pointer.
=head2 open_fd
# archive_write_open_fd
my $int1 = $w->open_fd($int2);
=head2 open_filename
# archive_write_open_filename
my $int = $w->open_filename($string);
=head2 open_filename_w
# archive_write_open_filename_w
my $int = $w->open_filename_w($wstring);
( run in 0.799 second using v1.01-cache-2.11-cpan-39bf76dae61 )