gather current branch and last commit
[scpubgit/System-Introspector.git] / lib / System / Introspector / Probe / FileHandles.pm
index 9b72367..0f17745 100644 (file)
@@ -2,7 +2,7 @@ package System::Introspector::Probe::FileHandles;
 use Moo;
 
 use System::Introspector::Util qw(
-    handle_from_command
+    lines_from_command
     transform_exceptions
 );
 
@@ -11,9 +11,9 @@ has lsof_command => (is => 'ro', default => sub { 'lsof' });
 sub gather {
     my ($self) = @_;
     return transform_exceptions {
-        my $pipe = $self->_open_lsof_pipe;
+        my @lines = lines_from_command [$self->_lsof_command_call];
         my @handles;
-        while (defined( my $line = <$pipe> )) {
+        for my $line (@lines) {
             chomp $line;
             my @fields = split m{\0}, $line;
             push @handles, { map {
@@ -25,10 +25,9 @@ sub gather {
     };
 }
 
-sub _open_lsof_pipe {
+sub _lsof_command_call {
     my ($self) = @_;
-    my $lsof = $self->lsof_command;
-    return handle_from_command "$lsof -F0";
+    return $self->lsof_command, '-F0';
 }
 
 1;
@@ -37,7 +36,7 @@ __END__
 
 =head1 NAME
 
-System::Introspector::FileHandles - Gather opened filehandles
+System::Introspector::Probe::FileHandles - Gather opened filehandles
 
 =head1 DESCRIPTION
 
@@ -51,5 +50,16 @@ Uses C<lsof> to build a list of open filehandles.
 
 =back
 
-=cut
+=head1 COPYRIGHT
+
+Copyright (c) 2012 the L<System::Introspector>
+L<AUTHOR|System::Introspector/AUTHOR>,
+L<CONTRIBUTORS|System::Introspector/CONTRIBUTORS> and
+L<SPONSORS|System::Introspector/SPONSORS>.
+
+=head1 LICENSE
 
+This library is free software and may be distributed under the same terms
+as perl itself.
+
+=cut