™.. Archive::Tar::File - Online Linux Manual PageSection : 3pm
Updated : 2017-03-22
Source : perl v5.10.1
Note : Perl Programmers Reference Guide

NAMEArchive::Tar::File − a subclass for in−memory extracted file from Archive::Tar

SYNOPSIS​ my @items = $tar−>get_files; ​ ​ print $_−>name, ' ', $_−>size, "\n" for @items; ​ ​ print $object−>get_content; ​ $object−>replace_content('new content'); ​ ​ $object−>rename( 'new/full/path/to/file.c' );

DESCRIPTIONArchive::Tar::Files provides a neat little object layer for in-memory extracted files. It's mostly used internally in Archive::Tar to tidy up the code, but there's no reason users shouldn't use this API as well.

AccessorsA lot of the methods in this package are accessors to the various fields in the tar header: name The file's name mode The file's mode uid The user id owning the file gid The group id owning the file size File size in bytes mtime Modification time. Adjusted to mac-time on MacOS if required chksum Checksum field for the tar header type File type \*(-- numeric, but comparable to exported constants \*(-- see Archive::Tar's documentation linkname If the file is a symlink, the file it's pointing to magic Tar magic string \*(-- not useful for most users version Tar version string \*(-- not useful for most users uname The user name that owns the file gname The group name that owns the file devmajor Device major number in case of a special file devminor Device minor number in case of a special file prefix Any directory to prefix to the extraction path, if any raw Raw tar header \*(-- not useful for most users

Methods

Archive::Tar::File−>new( file => $path )Returns a new Archive::Tar::File object from an existing file. Returns undef on failure.

Archive::Tar::File−>new( data => $path, $data, $opt )Returns a new Archive::Tar::File object from data. $path defines the file name (which need not exist), $data the file contents, and $opt is a reference to a hash of attributes which may be used to override the default attributes (fields in the tar header), which are described above in the Accessors section. Returns undef on failure.

Archive::Tar::File−>new( chunk => $chunk )Returns a new Archive::Tar::File object from a raw 512−byte tar archive chunk. Returns undef on failure.

$bool = $file>extract( [ $alternative_name ] )Extract this object, optionally to an alternative name. See \*(C`Archive::Tar\->extract_file\*(C'\fR for details. Returns true on success and false on failure.

$path = $file>full_pathReturns the full path from the tar header; this is basically a concatenation of the \*(C`prefix\*(C'\fR and \f(CW\*(C`name\*(C'\fR fields.

$bool = $file>validateDone by Archive::Tar internally when reading the tar file: validate the header against the checksum to ensure integer tar file. Returns true on success, false on failure

$bool = $file>has_contentReturns a boolean to indicate whether the current object has content. Some special files like directories and so on never will have any content. This method is mainly to make sure you don't get warnings for using uninitialized values when looking at an object's content.

$content = $file>get_contentReturns the current content for the in-memory file

$cref = $file>get_content_by_refReturns the current content for the in-memory file as a scalar reference. Normal users won't need this, but it will save memory if you are dealing with very large data files in your tar archive, since it will pass the contents by reference, rather than make a copy of it first.

$bool = $file>replace_content( $content )Replace the current content of the file with the new content. This only affects the in-memory archive, not the on-disk version until you write it. Returns true on success, false on failure.

$bool = $file>rename( $new_name )Rename the current file to $new_name. Note that you must specify a Unix path for $new_name, since per tar standard, all files in the archive must be Unix paths. Returns true on success and false on failure.

Convenience methodsTo quickly check the type of a \*(C`Archive::Tar::File\*(C'\fR object, you can use the following methods: $file>is_file Returns true if the file is of type \*(C`file\*(C'\fR $file>is_dir Returns true if the file is of type \*(C`dir\*(C'\fR $file>is_hardlink Returns true if the file is of type \*(C`hardlink\*(C'\fR $file>is_symlink Returns true if the file is of type \*(C`symlink\*(C'\fR $file>is_chardev Returns true if the file is of type \*(C`chardev\*(C'\fR $file>is_blockdev Returns true if the file is of type \*(C`blockdev\*(C'\fR $file>is_fifo Returns true if the file is of type \*(C`fifo\*(C'\fR $file>is_socket Returns true if the file is of type \*(C`socket\*(C'\fR $file>is_longlink Returns true if the file is of type \*(C`LongLink\*(C'\fR. Should not happen after a successful \*(C`read\*(C'\fR. $file>is_label Returns true if the file is of type \*(C`Label\*(C'\fR. Should not happen after a successful \*(C`read\*(C'\fR. $file>is_unknown Returns true if the file type is \*(C`unknown\*(C'\fR
0
Johanes Gumabo
Data Size   :   24,210 byte
man-Archive::Tar::File.3pmBuild   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   2 / 170,647
Visitor ID   :     :  
Visitor IP   :   18.118.144.50   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|249|Archive::Tar::File.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\| )         (htmlprn|149|Archive::Tar::File.3pm|36/37|.el══─{─══. ds --  —  |.el══─{─══. ds -- \|\(em\| )         (parse_manual_page_|249|Archive::Tar::File.3pm|41|br══─}─══|'br══─}─══ )         (htmlprn|149|Archive::Tar::File.3pm|41|'br══─}─══ |'br══─}─══ )         (rof_nr_x|149|Archive::Tar::File.3pm|51/52|\nF|.ie \nF ══─{─══. de IX )         (rof_unit_scale_px|41|Archive::Tar::File.3pm|51/52|F|.ie \nF ══─{─══. de IX )         (rof_if|19|Archive::Tar::File.3pm|51/52|\nF|.ie \nF ══─{─══. de IX )         (htmlprn|149|Archive::Tar::File.3pm|51/52|.ie \nF ══─{─══. de IX|.ie \nF ══─{─══. de IX )         (rof_escape_sequence|91|Archive::Tar::File.3pm|53|\$1\t\\n%\t"\\$2" |. tm Index:\\$1\t\\n%\t"\\$2" )         (parse_manual_page_|249|Archive::Tar::File.3pm|57|══─}─══|.══─}─══ )         (htmlprn|149|Archive::Tar::File.3pm|57|.══─}─══ |.══─}─══ )         (rof_escape_sequence|91|Archive::Tar::File.3pm|179|\*(-- numeric, but comparable to exported constants \*(-- see |File type \*(-- numeric, but comparable to exported constants \*(-- see )         (rof_escape_sequence|91|Archive::Tar::File.3pm|186|\*(-- not useful for most users |Tar magic string \*(-- not useful for most users )         (rof_escape_sequence|91|Archive::Tar::File.3pm|189|\*(-- not useful for most users |Tar version string \*(-- not useful for most users )         (rof_escape_sequence|91|Archive::Tar::File.3pm|207|\*(-- not useful for most users |Raw tar header \*(-- not useful for most users )         (rof_escape_sequence|91|Archive::Tar::File.3pm|239|\*(C`Archive::Tar\->extract_file\*(C'\fR for details. |See \f(CW\*(C`Archive::Tar\->extract_file\*(C'\fR for details. )         (rof_escape_sequence|91|Archive::Tar::File.3pm|246|\*(C`prefix\*(C'\fR and \f(CW\*(C`name\*(C'\fR fields. |concatenation of the \f(CW\*(C`prefix\*(C'\fR and \f(CW\*(C`name\*(C'\fR fields. )         (rof_escape_sequence|91|Archive::Tar::File.3pm|292|\*(C`Archive::Tar::File\*(C'\fR object, you can |To quickly check the type of a \f(CW\*(C`Archive::Tar::File\*(C'\fR object, you can )         (rof_escape_sequence|91|Archive::Tar::File.3pm|297|\*(C`file\*(C'\fR |Returns true if the file is of type \f(CW\*(C`file\*(C'\fR )         (rof_escape_sequence|91|Archive::Tar::File.3pm|301|\*(C`dir\*(C'\fR |Returns true if the file is of type \f(CW\*(C`dir\*(C'\fR )         (rof_escape_sequence|91|Archive::Tar::File.3pm|305|\*(C`hardlink\*(C'\fR |Returns true if the file is of type \f(CW\*(C`hardlink\*(C'\fR )         (rof_escape_sequence|91|Archive::Tar::File.3pm|309|\*(C`symlink\*(C'\fR |Returns true if the file is of type \f(CW\*(C`symlink\*(C'\fR )         (rof_escape_sequence|91|Archive::Tar::File.3pm|313|\*(C`chardev\*(C'\fR |Returns true if the file is of type \f(CW\*(C`chardev\*(C'\fR )         (rof_escape_sequence|91|Archive::Tar::File.3pm|317|\*(C`blockdev\*(C'\fR |Returns true if the file is of type \f(CW\*(C`blockdev\*(C'\fR )         (rof_escape_sequence|91|Archive::Tar::File.3pm|321|\*(C`fifo\*(C'\fR |Returns true if the file is of type \f(CW\*(C`fifo\*(C'\fR )         (rof_escape_sequence|91|Archive::Tar::File.3pm|325|\*(C`socket\*(C'\fR |Returns true if the file is of type \f(CW\*(C`socket\*(C'\fR )         (rof_escape_sequence|91|Archive::Tar::File.3pm|329|\*(C`LongLink\*(C'\fR. |Returns true if the file is of type \f(CW\*(C`LongLink\*(C'\fR. )         (rof_escape_sequence|91|Archive::Tar::File.3pm|330|\*(C`read\*(C'\fR. |Should not happen after a successful \f(CW\*(C`read\*(C'\fR. )         (rof_escape_sequence|91|Archive::Tar::File.3pm|334|\*(C`Label\*(C'\fR. |Returns true if the file is of type \f(CW\*(C`Label\*(C'\fR. )         (rof_escape_sequence|91|Archive::Tar::File.3pm|335|\*(C`read\*(C'\fR. |Should not happen after a successful \f(CW\*(C`read\*(C'\fR. )         (rof_escape_sequence|91|Archive::Tar::File.3pm|339|\*(C`unknown\*(C'\fR |Returns true if the file type is \f(CW\*(C`unknown\*(C'\fR )