Subject: | Interface names not detected in Solaris 10 |
Date: | Wed, 18 Jan 2012 11:31:18 +1100 |
To: | bug-Sys-HostAddr [...] rt.cpan.org |
From: | Matthew H <matt [...] cerebralsynergy.com> |
Hi test script is:
use Sys::HostAddr;
use Data::Dumper;
my $sysaddr = Sys::HostAddr->new();
my $aref = $sysaddr->ip();
print Dumper($aref);
Output causes warnings:
Use of uninitialized value in hash element at
/opt/IBM/site/perl5/lib/site_perl/Sys/HostAddr.pm line 135.
Use of uninitialized value in hash element at
/opt/IBM/site/perl5/lib/site_perl/Sys/HostAddr.pm line 135.
Looks like line 120 in HostAddr.pm:
if($line =~ /^([^\s:]+):?\s+/){
Isn't matching matching interfaces in Solaris, as the names can have colons
in them.
My workaround fix is:
if($line =~ /^(\S+)\s+flags/){
$interface = $1;
$interface =~ s/:$//;
Which seems to work under RHEL and Solaris, but I don't know about any
other platforms. Also not sure if having sub interface number in the name
is desired.
Cheers,
-Matt