From e534739d04f6c12d4e1c41b52d7ba9c170f16b45 Mon Sep 17 00:00:00 2001 From: "Zane C. Bowers-Hadley" Date: Tue, 13 Aug 2019 06:00:14 -0500 Subject: [PATCH] only call sysctl on bsd --- Net-Connection-lsof/lib/Net/Connection/lsof.pm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Net-Connection-lsof/lib/Net/Connection/lsof.pm b/Net-Connection-lsof/lib/Net/Connection/lsof.pm index f19b33b..8d65f2d 100644 --- a/Net-Connection-lsof/lib/Net/Connection/lsof.pm +++ b/Net-Connection-lsof/lib/Net/Connection/lsof.pm @@ -1,3 +1,4 @@ + package Net::Connection::lsof; use 5.006; @@ -16,11 +17,11 @@ Net::Connection::lsof - This uses lsof to generate a array of Net::Connection ob =head1 VERSION -Version 0.1.0 +Version 0.1.1 =cut -our $VERSION = '0.1.0'; +our $VERSION = '0.1.1'; =head1 SYNOPSIS @@ -125,9 +126,11 @@ sub lsof_to_nc_objects{ if ( $func_args{proc_info} ){ my $pt=Proc::ProcessTable->new; $proc_table=$pt->table; - $physmem=`/sbin/sysctl -a hw.physmem`; - chomp( $physmem ); - $physmem=~s/^.*\: //; + if ( $^O =~ /bsd/ ){ + $physmem=`/sbin/sysctl -a hw.physmem`; + chomp( $physmem ); + $physmem=~s/^.*\: //; + } } my $line_int=1;