Mojo::Tar::File - A Mojo::Tar file
my $file = Mojo::Tar->new(path => 'some/file.txt'); # This can be dangerous! Make sure path() does not contain ".." # or other dangerous path parts. $file->asset->move_to($file->path);
Mojo::Asset::File represents a tar file.
$file = $file->asset(Mojo::File->new); $asset = $file->asset;
Returns a Mojo::File object. Defaults to "tempfile" in Mojo::File.
This attribute is currently EXPERIMENTAL, but unlikely to change.
$str = $file->checksum;
Holds the checksum read by "from_header" or contains empty string if the checksum does not match. This attribute can also be built from all the attributes if "from_header" was not called.
This attribute is not supported yet. Pull request welcome!
$file = $file->gid(1001); $int = $file->gid;
The numeric representation of "group".
$file = $file->group('users') $str = $file->group;
The string representation of "gid".
$bool = $file->is_complete;
Returns true if "add_block" has added enough blocks to match "size".
$file = $file->mode(0644); # 0644 == 420 $int = $file->mode;
The file mode. Note that this is 10-base, meaning $int will be something like "420" and not "644".
$int
$file = $file->mtime(time); $epoch = $file->mtime;
Epoch timestamp for this file.
$file = $file->owner('jhthorsen') $str = $file->owner;
The string representation of "uid".
$file = $file->path('some/file/or/directory'); $str = $file->path;
The path from the tar file. This is constructed with both the filename and prefix (if any) in the ustar tar format.
$file = $file->size(42); $int = $file->size;
The size of the file in bytes.
$file = $file->symlink('path/for/symlink'); $str = $file->symlink;
This attribute is not fully supported yet. Pull request welcome!
$file = $file->type(5); $str = $file->type;
The tar file type.
This attribute is currently EXPERIMENTAL and might change from raw representation to something more readable.
$file = $file->uid(1001); $int = $file->uid;
The numeric representation of "owner".
$file = $file->add_block($bytes);
Used to add a block from of bytes from the tar file to the "asset".
$file = $file->from_header($bytes);
Will parse the header chunk from the tar file and set the "ATTRIBUTES".
$bytes = $file->to_header;
Will construct a header chunk from the "ATTRIBUTES".
Mojo::Tar.
To install Mojo::Tar, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mojo::Tar
CPAN shell
perl -MCPAN -e shell install Mojo::Tar
For more information on module installation, please visit the detailed CPAN module installation guide.