Archive-Libarchive-FFI
view release on metacpan or search on metacpan
my $archive = archive_write_new();
# many other formats are supported ...
archive_write_set_format_pax_restricted($archive);
archive_write_open_filename($archive, 'archive.tar');
foreach my $filename (@filenames)
{
my $entry = archive_entry_new();
archive_entry_set_pathname($entry, $filename);
archive_entry_set_size($entry, stat($filename)->size);
archive_entry_set_filetype($entry, AE_IFREG);
archive_entry_set_perm($entry, 0644);
archive_write_header($archive, $entry);
archive_write_data($archive, scalar read_file($filename));
archive_entry_free($entry);
}
archive_write_close($archive);
archive_write_free($archive);
DESCRIPTION
lib/Archive/Libarchive/FFI.pm view on Meta::CPAN
my $archive = archive_write_new();
# many other formats are supported ...
archive_write_set_format_pax_restricted($archive);
archive_write_open_filename($archive, 'archive.tar');
foreach my $filename (@filenames)
{
my $entry = archive_entry_new();
archive_entry_set_pathname($entry, $filename);
archive_entry_set_size($entry, stat($filename)->size);
archive_entry_set_filetype($entry, AE_IFREG);
archive_entry_set_perm($entry, 0644);
archive_write_header($archive, $entry);
archive_write_data($archive, scalar read_file($filename));
archive_entry_free($entry);
}
archive_write_close($archive);
archive_write_free($archive);
=head1 DESCRIPTION
lib/Archive/Libarchive/FFI/Function.pod view on Meta::CPAN
=head2 archive_entry_copy_sourcepath
my $status = archive_entry_set_sourcepath($entry, $sourcepath);
Sets the sourcepath property for the archive entry object.
This is an alias for archive_entry_set_sourcepath.
=head2 archive_entry_copy_stat
my $status = archive_entry_stat($entry, $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $atime, $mtime, $ctime);
Converts the various fields in the format used by L<stat|perlfunc#stat> to the fields store in the archive entry.
The fields C<$blksize>, C<$blocks> supported by L<stat|perlfunc#stat>, are not supported by this function.
This is an alias for L<archive_entry_set_stat|Archive::Libarchive::FFI::Function#archive_entry_set_stat>.
=head2 archive_entry_ctime
my $ctime = archive_entry_ctime($entry);
lib/Archive/Libarchive/FFI/Function.pod view on Meta::CPAN
Sets the size property for the archive entry.
=head2 archive_entry_set_sourcepath
my $status = archive_entry_set_sourcepath($entry, $sourcepath);
Sets the sourcepath property for the archive entry object.
=head2 archive_entry_set_stat
my $status = archive_entry_stat($entry, $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $atime, $mtime, $ctime);
Converts the various fields in the format used by L<stat|perlfunc#stat> to the fields store in the archive entry.
The fields C<$blksize>, C<$blocks> supported by L<stat|perlfunc#stat>, are not supported by this function.
=head2 archive_entry_set_symlink
my $status = archive_entry_set_symlink($entry, $string)
Sets the symlink for the archive entry object.
lib/Archive/Libarchive/FFI/Function.pod view on Meta::CPAN
}
=head2 archive_entry_sparse_reset
my $count = archive_entry_sparse_reset($entry);
Reset the internal sparse region iterator for the entry (see L<archive_entry_sparse_next|Archive::Libarchive::FFI::Function#archive_entry_sparse_next> for an example).
=head2 archive_entry_stat
my($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $atime, $mtime, $ctime) = archive_entry_stat($entry);
Converts the various fields stored in the archive entry to the format used by L<stat|perlfunc#stat>.
The fields C<$blksize>, C<$blocks> supported by L<stat|perlfunc#stat>, are not supported by this function.
=head2 archive_entry_strmode
my $strmode = archive_entry_strmode($entry);
Returns a string representation of the archive entry's permission mode,
t/common_stat.t view on Meta::CPAN
archive_entry_set_ino($entry, 0x5678);
archive_entry_set_mode($entry, 0400);
archive_entry_set_nlink($entry, 1);
archive_entry_set_uid($entry, 500);
archive_entry_set_gid($entry, 501);
archive_entry_set_rdev($entry, 0x1357);
archive_entry_set_atime($entry, 123456789, 123456789);
archive_entry_set_mtime($entry, 123456779, 123456779);
archive_entry_set_ctime($entry, 123456769, 123456769);
my($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $atime, $mtime, $ctime) = eval { archive_entry_stat($entry) };
diag $@ if $@;
is $dev, 0x1234, 'dev';
is $ino, 0x5678, 'ino';
is $mode, 0400, 'mode';
is $nlink, 1, 'nlink';
is $uid, 500, 'uid';
is $gid, 501, 'gid';
is $rdev, 0x1357, 'rdev';
is $atime, 123456789, 'atime';
t/common_stat.t view on Meta::CPAN
archive_entry_free($entry);
};
subtest 'archive_entry_set_stat' => sub {
plan tests => 10;
my $entry = archive_entry_new();
eval { archive_entry_set_stat($entry,0x1234,0x5678,0400,1,500,501,0x1357,123456789,123456779,123456769) };
diag $@ if $@;
my $dev = archive_entry_dev($entry);
my $ino = archive_entry_ino($entry);
my $mode = archive_entry_mode($entry);
my $nlink = archive_entry_nlink($entry);
my $uid = archive_entry_uid($entry);
my $gid = archive_entry_gid($entry);
my $rdev = archive_entry_rdev($entry);
my $atime = archive_entry_atime($entry);
( run in 1.180 second using v1.01-cache-2.11-cpan-49f99fa48dc )