1 package DX::Lib::FS::Action::CreateFile;
3 use aliased 'DX::Lib::FS::Fact::FileContent';
4 use aliased 'DX::Lib::FS::Fact::PathStatus';
5 use aliased 'DX::Lib::FS::Fact::PathStatusInfo';
8 with 'DX::Role::Action';
9 with 'DX::Lib::FS::Role::RunOn';
11 has path => (is => 'ro', required => 1);
13 has mode => (is => 'ro', predicate => 1);
15 has data => (is => 'ro', default => sub { '' });
19 return +(path_status => PathStatus->new(
21 info => PathStatusInfo->new(
23 mode => ($self->has_mode ? $self->mode : '')
25 ), file_content => FileContent->new(
33 $self->_call_guts(create_file => $self->mode, $self->data);
34 +(path_status => $self->path);
38 $_[0]->but(data => $_[0]->data.$_[1]."\n")