Archive-Libarchive-XS
view release on metacpan or search on metacpan
lib/Archive/Libarchive/XS/Callback.pm view on Meta::CPAN
my $status2 = archive_write_open($archive, undef, $mywrite, undef);
This callback is called whenever libarchive has data it wants to send
to output. The callback itself takes one additional argument, a
buffer containing the data to write.
It should return the actual number of bytes written by you, or an
status value for an error.
=head2 skip
my $status1 = archive_read_set_skip_callback($archive, sub {
my($archive, $data, $request) = @_;
...
return $status2;
});
The skip callback takes one additional argument, $request.
Can also be set when you call
L<archive_read_open2|Archive::Libarchive::XS::Function#archive_read_open2>.
=head2 seek
my $status1 = archive_read_set_seek_callback($archive, sub {
my($archive, $data, $offset, $whence) = @_;
...
return $status2;
});
The seek callback should implement an interface identical to the UNIX
C<fseek> function.
=head2 close
my $status1 = archive_read_set_close_callback($archive, sub {
my($archive, $data) = @_;
...
return $status2;
});
Called when the archive (either input or output) should be closed.
Can also be set when you call
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>.
=head2 user id lookup
my $status = archive_write_disk_set_user_lookup($archive, $data, sub {
my($data, $name, $uid) = @_;
... # should return the UID for $name or $uid if it can't be found
}, undef);
Called by archive_write_disk_uid to determine appropriate UID.
=head2 group id lookup
my $status = archive_write_disk_set_group_lookup($archive, $data, sub {
my($data, $name, $gid) = @_;
... # should return the GID for $name or $gid if it can't be found
}, undef);
Called by archive_write_disk_gid to determine appropriate GID.
=head2 user name lookup
my $status = archive_read_disk_set_uname_lookup($archive, $data, sub
my($data, $uid) = @_;
... # should return the name for $uid, or undef
}, undef);
Called by archive_read_disk_uname to determine appropriate user name.
=head2 group name lookup
my $status = archive_read_disk_set_gname_lookup($archive, $data, sub
my($data, $gid) = @_;
... # should return the name for $gid, or undef
}, undef);
Called by archive_read_disk_gname to determine appropriate group name.
=head2 lookup cleanup
sub mycleanup
{
my($data) = @_;
... # any cleanup necessary
}
my $status = archive_write_disk_set_user_lookup($archive, $data, \&mylookup, \&mcleanup);
...
archive_write_disk_set_user_lookup($archive, undef, undef, undef); # mycleanup will be called here
Called when the lookup is registered (can also be passed into
L<archive_write_disk_set_group_lookup|Archive::Libarchive::XS::Function#archive_write_disk_set_group_lookup>,
L<archive_read_disk_set_uname_lookup|Archive::Libarchive::XS::Function#archive_read_disk_set_uname_lookup>,
and
L<archive_read_disk_set_gname_lookup|Archive::Libarchive::XS::Function#archive_read_disk_set_gname_lookup>.
=head1 SEE ALSO
=over 4
=item L<Archive::Libarchive::XS>
=item L<Archive::Libarchive::XS::Constant>
=item L<Archive::Libarchive::XS::Function>
=back
=head1 AUTHOR
Graham Ollis <plicease@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Graham Ollis.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
( run in 2.653 seconds using v1.01-cache-2.11-cpan-63c85eba8c4 )