Apache-Logmonster
view release on metacpan or search on metacpan
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
103110321033103410351036103710381039104010411042104310441045104610471048104910501051
my
$debug
=
$p
{debug};
my
$only
=
$p
{only};
my
$ifconfig
=
$self
->find_bin(
"ifconfig"
,
debug
=> 0 );
my
$once
= 0;
TRY:
my
@ips
=
grep
{/inet/} `
$ifconfig
`;
chomp
@ips
;
@ips
=
grep
{!/inet6/}
@ips
if
$p
{exclude_ipv6};
@ips
=
grep
{!/inet 127\.0\.0/}
@ips
if
$p
{exclude_localhost};
@ips
=
grep
{!/inet (192\.168\.|10\.|172\.16\.|169\.254\.)/}
@ips
if
$p
{exclude_internals};
# this keeps us from failing if the box has only internal IPs
if
(
@ips
< 1 ||
$ips
[0] eq
""
) {
carp
"yikes, you really don't have any public IPs?!"
if
$debug
;
$p
{exclude_internals} = 0;
$once
++;
goto
TRY
if
(
$once
< 2 );
( run in 0.235 second using v1.01-cache-2.11-cpan-1dc43b0fbd2 )