Archive-Libarchive-FFI

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

     archive_write_data($archive, encode('UTF-8', "привет.txt");
     # or
     archive_write_data($archive, encode('KOI8-R', "привет.txt");

    read:

     use Encode qw( decode );
     
     my $raw;
     archive_read_data($archive, $raw, 10240);
     my $decoded_content = decode('UTF-8', $raw);
     # or
     my $decoded_content = decode('KOI8-R', $raw);

SUPPORT

    If you find bugs, please open an issue on the project GitHub
    repository:

    https://github.com/plicease/Archive-Libarchive-FFI/issues?state=open

    If you have a fix, please open a pull request. You can see the
    CONTRIBUTING file for traps, hints and pitfalls.

lib/Archive/Libarchive/FFI.pm  view on Meta::CPAN

} for (
  'archive_read_append_filter_program_signature',
# TODO:
# using archive_read_support_compression_program_signature for archive_read_support_filter_program_signature doesn't
# appear to actually work for libarchive 2.x, so I am commenting it out for now.  This does appear to make it slightly
# out of sync with the capability of the XS version, so if you need this function either use the XS version, or
# upgrade to libarchie >= 3
#  archive_version_number() >= 3000000 ? 'archive_read_support_filter_program_signature' : [ archive_read_support_compression_program_signature => 'archive_read_support_filter_program_signature']);
  'archive_read_support_filter_program_signature');

# this is an unusual one which doesn't need to be decoded
# because it should always be ASCII
_attach_function 'archive_entry_strmode',                 [ _ptr ], _str;

_attach_function 'archive_entry_linkify', [ _ptr, _ptr, _ptr ], _void, sub
{
  my $ptr1 = FFI::Raw::MemPtr->new_from_ptr($_[2]);
  my $ptr2 = FFI::Raw::MemPtr->new_from_ptr($_[3]);
  $_[0]->($_[1], $ptr1, $ptr2);
  $_[2] = deref_ptr_get($ptr1);
  $_[3] = deref_ptr_get($ptr2);

lib/Archive/Libarchive/FFI.pm  view on Meta::CPAN

 archive_write_data($archive, encode('UTF-8', "привет.txt");
 # or
 archive_write_data($archive, encode('KOI8-R', "привет.txt");

read:

 use Encode qw( decode );
 
 my $raw;
 archive_read_data($archive, $raw, 10240);
 my $decoded_content = decode('UTF-8', $raw);
 # or
 my $decoded_content = decode('KOI8-R', $raw);

=head1 SUPPORT

If you find bugs, please open an issue on the project GitHub repository:

L<https://github.com/plicease/Archive-Libarchive-FFI/issues?state=open>

If you have a fix, please open a pull request.  You can see the CONTRIBUTING
file for traps, hints and pitfalls.



( run in 1.874 second using v1.01-cache-2.11-cpan-0a987023a57 )