view release on metacpan or search on metacpan
lib/Archive/Libarchive/XS.xs view on Meta::CPAN
A convenience function that repeatedly calls L<#archive_read_data_block> to copy the entire entry to the provided file handle.
=head2 archive_write_disk_set_group_lookup
my $status = archive_write_disk_set_group_lookup($archive, $data, $lookup_callback, $cleanup_callback);
Register a callback for the lookup of group names from group id numbers. In order to deregister
call C<archive_write_disk_set_group_lookup> with both callback functions set to C<undef>.
See L<Archive::Libarchive::XS::Callback> for calling conventions for the lookup and cleanup callbacks.
=cut
#if HAS_archive_write_disk_set_group_lookup
int
archive_write_disk_set_group_lookup(archive, data, lookup_callback, cleanup_callback)
struct archive *archive
SV *data
SV *lookup_callback
lib/Archive/Libarchive/XS.xs view on Meta::CPAN
#endif
=head2 archive_read_disk_set_gname_lookup
my $status = archive_read_disk_set_gname_lookup($archive, $data, $lookup_callback, $cleanup_callback);
Register a callback for the lookup of GID from group names. In order to deregister call
C<archive_read_disk_set_gname_lookup> with both callback functions set to C<undef>.
See L<Archive::Libarchive::XS::Callback> for calling conventions for the lookup and cleanup callbacks.
=cut
#if HAS_archive_read_disk_set_gname_lookup
int
archive_read_disk_set_gname_lookup(archive, data, lookup_callback, cleanup_callback)
struct archive *archive
SV *data
SV *lookup_callback
lib/Archive/Libarchive/XS.xs view on Meta::CPAN
#endif
=head2 archive_read_disk_set_uname_lookup
my $status = archive_read_disk_set_uname_lookup($archive, $data, $lookup_callback, $cleanup_callback);
Register a callback for the lookup of UID from user names. In order to deregister call
C<archive_read_disk_setugname_lookup> with both callback functions set to C<undef>.
See L<Archive::Libarchive::XS::Callback> for calling conventions for the lookup and cleanup callbacks.
=cut
#if HAS_archive_read_disk_set_uname_lookup
int
archive_read_disk_set_uname_lookup(archive, data, lookup_callback, cleanup_callback)
struct archive *archive
SV *data
SV *lookup_callback
lib/Archive/Libarchive/XS.xs view on Meta::CPAN
#endif
=head2 archive_write_disk_set_user_lookup
my $status = archive_write_disk_set_user_lookup($archive, $data, $lookup_callback, $cleanup_callback);
Register a callback for the lookup of user names from user id numbers. In order to deregister
call C<archive_write_disk_set_user_lookup> with both callback functions set to C<undef>.
See L<Archive::Libarchive::XS::Callback> for calling conventions for the lookup and cleanup callbacks.
=cut
#if HAS_archive_write_disk_set_user_lookup
int
archive_write_disk_set_user_lookup(archive, data, lookup_callback, cleanup_callback)
struct archive *archive
SV *data
SV *lookup_callback
lib/Archive/Libarchive/XS.xs view on Meta::CPAN
RETVAL
#endif
=head2 archive_write_add_filter_program
my $status = archive_write_add_filter_program($archive, $cmd);
The archive will be fed into the specified compression program.
The output of that program is blocked and written to the client
write callbacks.
=cut
#if HAS_archive_write_add_filter_program
int
_archive_write_add_filter_program(archive, cmd)
struct archive *archive
const char *cmd
CODE:
lib/Archive/Libarchive/XS.xs view on Meta::CPAN
);
OUTPUT:
RETVAL
#endif
=head2 archive_read_set_callback_data
my $status = archive_read_set_callback_data($archive, $data);
Set the client data for callbacks.
=cut
#if HAS_archive_read_set_callback_data
int
_archive_read_set_callback_data(archive, data)
struct archive *archive
void *data
CODE:
lib/Archive/Libarchive/XS.xs view on Meta::CPAN
RETVAL = archive_read_set_callback_data(archive, data);
OUTPUT:
RETVAL
#endif
=head2 archive_read_open1
my $status = archive_read_open1($archive);
Opening freezes the callbacks.
=cut
#if HAS_archive_read_open1
int
archive_read_open1(archive)
struct archive *archive
#endif
lib/Archive/Libarchive/XS.xs view on Meta::CPAN
RETVAL
#endif
=head2 archive_set_error
my $status = archive_set_error($archive, $errno, $format, @args);
Sets the numeric error code and error description that will be returned by
L<#archive_errno> and L<#archive_error_string>. This function should be
used within I/O callbacks to set system-specific error codes and error
descriptions. This function accepts a printf-like format string and
arguments (via perl's L<sprintf|perlfunc#sprintf>.
=cut
#if HAS_archive_set_error
int
_archive_set_error(archive, status, string)
struct archive *archive
lib/Archive/Libarchive/XS/Callback.pm view on Meta::CPAN
CB_DATA => 0,
CB_READ => 1,
CB_CLOSE => 2,
CB_OPEN => 3,
CB_WRITE => 4,
CB_SKIP => 5,
CB_SEEK => 6,
CB_BUFFER => 7,
};
my %callbacks;
sub ARCHIVE_FATAL ();
sub ARCHIVE_OK ();
sub archive_read_set_callback_data ($$)
{
my($archive, $data) = @_;
$callbacks{$archive}->[CB_DATA] = $data;
ARCHIVE_OK;
}
foreach my $name (qw( open read skip close seek ))
{
my $const = 'CB_' . uc $name;
eval '# line '. __LINE__ . ' "' . __FILE__ . "\n" . qq{
sub archive_read_set_$name\_callback (\$\$)
{
my(\$archive, \$callback) = \@_;
\$callbacks{\$archive}->[$const] = \$callback;
_archive_read_set_$name\_callback(\$archive, \$callback);
}
}; die $@ if $@;
}
foreach my $name (qw( open skip close seek ))
{
my $uc_name = uc $name;
eval '# line '. __LINE__ . ' "' . __FILE__ . "\n" . qq{
sub _my$name
{
my \$archive = shift;
my \$status = eval { \$callbacks{\$archive}->[CB_$uc_name]->(\$archive, \$callbacks{\$archive}->[CB_DATA],\@_) };
if(\$\@)
{
warn \$\@;
return ARCHIVE_FATAL;
}
\$status;
}
}; die $@ if $@;
}
sub _myread
{
my($archive) = @_;
my ($status, $buffer) = eval {
$callbacks{$archive}->[CB_READ]->(
$archive,
$callbacks{$archive}->[CB_DATA],
)
};
if($@)
{
warn $@;
return (ARCHIVE_FATAL, undef);
}
$callbacks{$archive}->[CB_BUFFER] = \$buffer;
($status, $callbacks{$archive}->[CB_BUFFER]);
}
sub _mywrite
{
my($archive, $buffer) = @_;
my $status = eval {
$callbacks{$archive}->[CB_WRITE]->(
$archive,
$callbacks{$archive}->[CB_DATA],
$buffer,
)
};
if($@)
{
warn $@;
return ARCHIVE_FATAL;
}
$status;
}
sub archive_read_open ($$$$$)
{
my($archive, $data, $opencb, $readcb, $closecb) = @_;
$callbacks{$archive}->[CB_DATA] = $data if defined $data;
$callbacks{$archive}->[CB_OPEN] = $opencb if defined $opencb;
$callbacks{$archive}->[CB_READ] = $readcb if defined $readcb;
$callbacks{$archive}->[CB_CLOSE] = $closecb if defined $closecb;
my $ret = _archive_read_open($archive, $data, $opencb, $readcb, $closecb);
$ret;
}
sub archive_read_open2 ($$$$$$)
{
my($archive, $data, $opencb, $readcb, $skipcb, $closecb) = @_;
$callbacks{$archive}->[CB_DATA] = $data if defined $data;
$callbacks{$archive}->[CB_OPEN] = $opencb if defined $opencb;
$callbacks{$archive}->[CB_READ] = $readcb if defined $readcb;
$callbacks{$archive}->[CB_SKIP] = $skipcb if defined $skipcb;
$callbacks{$archive}->[CB_CLOSE] = $closecb if defined $closecb;
my $ret = _archive_read_open2($archive, $data, $opencb, $readcb, $skipcb, $closecb);
$ret;
}
sub archive_write_open ($$$$$)
{
my($archive, $data, $opencb, $writecb, $closecb) = @_;
$callbacks{$archive}->[CB_DATA] = $data if defined $data;
$callbacks{$archive}->[CB_OPEN] = $opencb if defined $opencb;
$callbacks{$archive}->[CB_WRITE] = $writecb if defined $writecb;
$callbacks{$archive}->[CB_CLOSE] = $closecb if defined $closecb;
my $ret = _archive_write_open($archive, $data, $opencb, $writecb, $closecb);
$ret;
}
sub archive_read_free ($)
{
my($archive) = @_;
my $ret = _archive_read_free($archive);
delete $callbacks{$archive};
$ret;
}
sub archive_write_free ($)
{
my($archive) = @_;
my $ret = _archive_write_free($archive);
delete $callbacks{$archive};
$ret;
}
sub archive_set_error
{
my($archive, $errno, $format, @args) = @_;
my $string = sprintf $format, @args;
_archive_set_error($archive, $errno, $string);
}
lib/Archive/Libarchive/XS/Callback.pm view on Meta::CPAN
archive_read_open($archive, $data, \&myopen, \&myread, \&myclose);
# write
my $archive = archive_write_new();
archive_write_open($archive, $data, \&myopen, \&mywrite, \&myclose);
=head1 DESCRIPTION
This document provides information of callback routines for writing
custom input/output interfaces to the libarchive perl bindings. The
first two arguments passed into all callbacks are:
=over 4
=item $archive
The archive object (actually a pointer to the C structure that managed
the archive object).
=item $data
The callback data object (any legal Perl data structure).
=back
For the variable name / types conventions used in this document, see
L<Archive::Libarchive::XS::Function>.
The expected return value for all callbacks EXCEPT the read callback
is a standard integer libarchive status value (example: C<ARCHIVE_OK>
or C<ARCHIVE_FATAL>).
If your callback dies (throws an exception), it will be caught at the
Perl level. The error will be sent to standard error via L<warn|perlfunc#warn>
and C<ARCHIVE_FATAL> will be passed back to libarchive.
=head2 data
There is a data field for callbacks associated with each $archive object.
It can be any native Perl type (example: scalar, hashref, coderef, etc).
You can set this by calling
L<archive_read_set_callback_data|Archive::Libarchive::XS::Function#archive_read_set_callback_data>,
or by passing the data argument when you "open" the archive using
L<archive_read_open|Archive::Libarchive::XS::Function#archive_read_open>,
L<archive_read_open2|Archive::Libarchive::XS::Function#archive_read_open2> or
L<archive_write_open|Archive::Libarchive::XS::Function#archive_write_open>.
The data field will be passed into each callback as its second argument.
lib/Archive/Libarchive/XS/Function.pod view on Meta::CPAN
Undocumented libarchive function.
=head2 archive_read_disk_set_gname_lookup
my $status = archive_read_disk_set_gname_lookup($archive, $data, $lookup_callback, $cleanup_callback);
Register a callback for the lookup of GID from group names. In order to deregister call
C<archive_read_disk_set_gname_lookup> with both callback functions set to C<undef>.
See L<Archive::Libarchive::XS::Callback> for calling conventions for the lookup and cleanup callbacks.
=head2 archive_read_disk_set_standard_lookup
my $status = archive_read_disk_set_standard_lookup($archive);
This convenience function installs a standard set of user and group name lookup functions.
These functions use C<getpwuid> and C<getgrgid> to convert ids to names, defaulting to C<undef>.
if the names cannot be looked up. These functions also implement a simple memory cache to
reduce the number of calls to C<getpwuid> and C<getgrgid>.
lib/Archive/Libarchive/XS/Function.pod view on Meta::CPAN
This sets the mode used for handling symbolic links. The "physical" mode does not
follow any symbolic links.
=head2 archive_read_disk_set_uname_lookup
my $status = archive_read_disk_set_uname_lookup($archive, $data, $lookup_callback, $cleanup_callback);
Register a callback for the lookup of UID from user names. In order to deregister call
C<archive_read_disk_setugname_lookup> with both callback functions set to C<undef>.
See L<Archive::Libarchive::XS::Callback> for calling conventions for the lookup and cleanup callbacks.
=head2 archive_read_disk_uname
my $string = archive_read_disk_uname($archive, $gid);
Returns a user name given a uid value. By default always
returns C<undef>.
=head2 archive_read_extract
lib/Archive/Libarchive/XS/Function.pod view on Meta::CPAN
=head2 archive_read_open
my $status = archive_read_open($archive, $data, $open_cb, $read_cb, $close_cb);
The same as C<archive_read_open2>, except that the skip callback is assumed to be C<undef>.
=head2 archive_read_open1
my $status = archive_read_open1($archive);
Opening freezes the callbacks.
=head2 archive_read_open2
my $status = archive_read_open2($archive, $data, $open_cb, $read_cb, $skip_cb, $close_cb);
Freeze the settings, open the archive, and prepare for reading entries. This is the most
generic version of this call, which accepts four callback functions. Most clients will
want to use C<archive_read_open_filename>, C<archive_read_open_FILE>, C<archive_read_open_fd>,
or C<archive_read_open_memory> instead. The library invokes the client-provided functions to
obtain raw bytes from the archive.
lib/Archive/Libarchive/XS/Function.pod view on Meta::CPAN
archive using C<archive_read_free>.
Bad things will happen if the buffer falls out of scope and is deallocated
before you free the archive, so make sure that there is a reference to the
buffer somewhere in your programmer until C<archive_read_free> is called.
=head2 archive_read_set_callback_data
my $status = archive_read_set_callback_data($archive, $data);
Set the client data for callbacks.
=head2 archive_read_set_close_callback
my $status = archive_read_set_close_callback($archive, $callback);
Set the close callback for the archive object.
=head2 archive_read_set_filter_option
my $status = archive_read_set_filter_option($archive, $module, $option, $value);
lib/Archive/Libarchive/XS/Function.pod view on Meta::CPAN
my $count_or_status = archive_seek_data($archive, $offset, $whence);
Seek within the body of an entry. Similar to C<lseek>.
=head2 archive_set_error
my $status = archive_set_error($archive, $errno, $format, @args);
Sets the numeric error code and error description that will be returned by
L<archive_errno|Archive::Libarchive::XS::Function#archive_errno> and L<archive_error_string|Archive::Libarchive::XS::Function#archive_error_string>. This function should be
used within I/O callbacks to set system-specific error codes and error
descriptions. This function accepts a printf-like format string and
arguments (via perl's L<sprintf|perlfunc#sprintf>.
=head2 archive_version_number
my $version = archive_version_number();
Return the libarchive version as an integer.
=head2 archive_version_string
lib/Archive/Libarchive/XS/Function.pod view on Meta::CPAN
my $status = archive_write_add_filter_none($archive);
Add none filter
=head2 archive_write_add_filter_program
my $status = archive_write_add_filter_program($archive, $cmd);
The archive will be fed into the specified compression program.
The output of that program is blocked and written to the client
write callbacks.
=head2 archive_write_add_filter_uuencode
my $status = archive_write_add_filter_uuencode($archive);
Add uuencode filter
=head2 archive_write_add_filter_xz
my $status = archive_write_add_filter_xz($archive);
lib/Archive/Libarchive/XS/Function.pod view on Meta::CPAN
(Depending on the implementation), either way, it can be passed into
any of the write functions documented here with an C<$archive> argument.
=head2 archive_write_disk_set_group_lookup
my $status = archive_write_disk_set_group_lookup($archive, $data, $lookup_callback, $cleanup_callback);
Register a callback for the lookup of group names from group id numbers. In order to deregister
call C<archive_write_disk_set_group_lookup> with both callback functions set to C<undef>.
See L<Archive::Libarchive::XS::Callback> for calling conventions for the lookup and cleanup callbacks.
=head2 archive_write_disk_set_options
my $status = archive_write_disk_set_options($archive, $flags);
The options field consists of a bitwise OR of one or more of the
following values:
=over 4
lib/Archive/Libarchive/XS/Function.pod view on Meta::CPAN
a simple memory cache to reduce the number of calls to
C<getpwnam> and C<getgrnam>.
=head2 archive_write_disk_set_user_lookup
my $status = archive_write_disk_set_user_lookup($archive, $data, $lookup_callback, $cleanup_callback);
Register a callback for the lookup of user names from user id numbers. In order to deregister
call C<archive_write_disk_set_user_lookup> with both callback functions set to C<undef>.
See L<Archive::Libarchive::XS::Callback> for calling conventions for the lookup and cleanup callbacks.
=head2 archive_write_disk_uid
my $int64 = archive_write_disk_uid($archive, $string, $int64);
Undocumented libarchive function.
=head2 archive_write_fail
my $status = archive_write_fail($archive);
xt/author/pod_spelling_system.t view on Meta::CPAN
Ollis
Mojolicious
plicease
CPAN
reinstall
TODO
filename
filenames
login
callback
callbacks
standalone
VMS
hostname
hostnames
TCP
UDP
IP
API
MSWin32
OpenBSD