NAME

Mojo::File - File

SYNOPSIS

use Mojo::File;

my $file = Mojo::File->new('Hello!');
$file->add_chunk('World!');
print $file->slurp;

DESCRIPTION

Mojo::File is a container for files.

ATTRIBUTES

Mojo::File implements the following attributes.

cleanup

my $cleanup = $file->cleanup;
$file       = $file->cleanup(1);

handle

my $handle = $file->handle;
$file      = $file->handle(IO::File->new);

path

my $path = $file->path;
$file    = $file->path('/foo/bar.txt');

METHODS

Mojo::File inherits all methods from Mojo::Base and implements the following new ones.

new

my $file = Mojo::File->new('Hello World!');

add_chunk

$file = $file->add_chunk('test 123');

contains

my $contains = $file->contains('random string');

copy_to

$file = $file->copy_to('/foo/bar/baz.txt');

get_chunk

my $chunk = $file->get_chunk($offset);

length

my $length = $file->length;

move_to

$file = $file->move_to('/foo/bar/baz.txt');

slurp

my $string = $file->slurp;