From: Robert 'phaylon' Sedlacek Date: Thu, 10 May 2012 02:05:08 +0000 (+0000) Subject: added lines_from_command util X-Git-Tag: v0.001_001~93 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=91c60940ac23960e391fe78d6e65cea525be8696;p=scpubgit%2FSystem-Introspector.git added lines_from_command util --- diff --git a/lib/System/Introspector/Util.pm b/lib/System/Introspector/Util.pm index f2a7555..7be2fc1 100644 --- a/lib/System/Introspector/Util.pm +++ b/lib/System/Introspector/Util.pm @@ -7,9 +7,10 @@ use IPC::Run qw( run ); our @EXPORT_OK = qw( handle_from_command handle_from_file - files_from_dir output_from_command output_from_file + lines_from_command + files_from_dir transform_exceptions ); @@ -50,6 +51,13 @@ sub output_from_command { return $out; } +sub lines_from_command { + my ($command) = @_; + my $output = output_from_command $command; + chomp $output; + return split m{\n}, $output; +} + sub handle_from_command { my ($command) = @_; open my $pipe, '-|', $command