NAME
Sweet::Dir
SYNOPSIS
use Sweet::Dir;
my $dir = Sweet::Dir->new(path => '/path/to/dir');
$dir->create;
say $dir; # /path/to/dir
ATTRIBUTES
path
METHODS
create
$dir->create;
does_not_exists
$dir->create if $dir->does_not_exists;
erase
$dir->erase;
file
Instance of file inside dir. Returns a Sweet::File.
my $file = $dir->file('foo.txt');
say $file; # /path/to/dir/foo.txt
is_a_directory
# Create dir if it does not exists.
$dir->is_a_directory or $dir->create;
sub_dir
my $dir2 = $dir->sub_dir('foo', bar');
# Or pass an arrayref if you prefer.
# my $dir2 = $dir->sub_dir(['foo', bar']);
# Create foo/bar sub directory.
$dir2->create;