Sys::Net - system network information or actions


Test-Server documentation  | view source Contained in the Test-Server distribution.

Index


NAME

Top

Sys::Net - system network information or actions

SYNOPSIS

Top

	my %if_named = %{Sys::Net::interfaces()};
	foreach my $if_name (keys %if_named) {
		print 'interface with name: ', $if_name, ' has ip: ', $if_named{$if_name}, "\n";
	}

	use Sys::Net 'resolv';
	my $hostname = resolv('127.0.0.1');
	my $ip       = resolv('localhost');




DESCRIPTION

Top

The purpouse is to find out network information or perform system network actions.

System network interfaces for the moment works just for Linux, and gets only ipv4 ip of the system interfaces. Will be extended when a need arrise.

METHODS

Top

EXPORTS

	our @EXPORT_OK = qw(resolv interfaces);

interfaces()

returns hash ref with:

	{
		'lo'   => { 'ip' => '127.0.0.1'     },
		'eth0' => { 'ip' => '192.168.100.6' },
	};

TODO more information than just an ip.

resolv()

Resolv hostname to an ip or ip to an hostname.

Using gethostbyaddr or gethostbyname so also hosts in /etc/hosts are taken into an account.

AUTHOR

Top

Jozef Kutej


Test-Server documentation  | view source Contained in the Test-Server distribution.