X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDX%2FLib%2FFS%2FObservation%2FFileContent.pm;h=ee5a441c6116fdd52d5fdb1c801540bd0afa7312;hb=0d1a41d9db9e712b545964675ede067d69d40978;hp=f0e2bb4ea43ac275691ee2c7319305a386b3810d;hpb=887a32a0d7b5b7f8b650bcc277131f9dc4501709;p=scpubgit%2FDKit.git diff --git a/lib/DX/Lib/FS/Observation/FileContent.pm b/lib/DX/Lib/FS/Observation/FileContent.pm index f0e2bb4..ee5a441 100644 --- a/lib/DX/Lib/FS/Observation/FileContent.pm +++ b/lib/DX/Lib/FS/Observation/FileContent.pm @@ -1,18 +1,15 @@ package DX::Lib::FS::Observation::FileContent; use DX::Lib::FS::Fact::FileContent; +use DX::Lib::FS::Guts; use Moo; has path => (is => 'ro', required => 1); sub run { my ($self) = @_; - return () unless -e $self->path; - my $data = do { - open my $fh, '<', $self->path or die "Couldn't open ${\$self->path}: $!"; - local $/; - readline($fh) - }; + my $data = DX::Lib::FS::Guts->file_content($self->path); + return () unless defined($data); +(file_content => DX::Lib::FS::Fact::FileContent->new( path => $self->path, data => $data