beginnings of FS lib
[scpubgit/DKit.git] / lib / DX / Lib / FS / Action / CreateFile.pm
CommitLineData
4d2ad771 1package DX::Lib::FS::Action::CreateFile;
2
3use aliased 'DX::Lib::FS::Fact::PathStatus';
4use aliased 'DX::Lib::FS::Fact::PathStatusInfo';
5use Moo;
6
7with 'DX::Role::Action';
8
9has path => (is => 'ro', required => 1);
10
11sub expected_effect {
12 my ($self) = @_;
13 return +(path_status => PathStatus->new(
14 path => $self->path,
15 info => PathStatusInfo->new(is_file => 1, mode => '')
16 ));
17}
18
19sub _do_run {
20 my ($self) = @_;
21 open my $fh, '>>', $self->path or die "Couldn't create ${\$self->path}: $!";
22 +(path_status => PathStatus->new(path => $self->path));
23}
24
251;