my $if = new Net::Link('eth0');
print "Got uplink.\n" if($if->up);
This is a simple extension of Net::Interface that adds two methods to determine if a network interface has a link/carrier. The information is taken from the 'sysfs', a virtual file system on Linux systems that provides system information (so the module will work on Linux only). The module has been tested with ethernet and wireless network devices.
For ethernet devices, being "up" means that there's a ethernet cable plugged in the port.
For wireless network devices, having an uplink means that the device is associated to an access point or something else.
The information provided by this module affects only the "link" level. For higher level information (IP address, netmask, etc.), use the methods provided by Net::Interface.
The added methods are "up" and "down". Both return a boolean.
Copyright (C) 2008 by Jonas Kramer <firstname.lastname@example.org>. Published under the terms of the Artistic License 2.0.
To install Net::Link, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.