ActiveState::Unix::Network - Portable way to determine host networking info

NAME

ActiveState::Unix::Network - Portable way to determine host networking info

SYNOPSIS

 use ActiveState::Unix::Network qw(interfaces);
 my $interfaces = interfaces;
 foreach my $i (@$interfaces) {
     foreach (qw(ip netmask subnet)) {
         print "ip = $i->{$_}\n";
     }
     print "\n";
 }

DESCRIPTION

This module provides a single function called interfaces() that will run ifconfig (and lanscan on HPUX) to examine the external network interfaces. It will parse the networking info and return an array of external interfaces.

interfaces()

This function will return an arrayref containing a hashref for each of the interfaces discovered. Each hashref will contain the following keys:

ip
netmask
subnet
network_bits

Number of network bits in IP address (used for CIDR blocks).

mask_off( $ip, $mask )

Computes the subnet from an IP and netmask.

num2ip( $ip )

Converts an IP address from numeric to string form.

NOTES

These functions currently only support IPv4 addresses.

COPYRIGHT

Copyright (C) 2005 ActiveState Software Inc. All rights reserved.