My script is now:
#! /usr/bin/perl -w
use Data::Dumper::Simple;
use IO::Interface::Simple;
my @interfaces = IO::Interface::Simple->interfaces;
#print Dumper @interfaces;
for my $if (@interfaces) {
next if $if =~ /usb|iwn|lo/;
print "interface = " . $if . "\n";
print "addr = " . $if->address . "\n";
print "broadcast = " . $if->broadcast ."\n";
print "netmask = " . $if->netmask ."\n";
print "dstaddr = " . $if->dstaddr . "\n"; # line 15
print "hwaddr = " . $if->hwaddr . "\n"; # line 16
print "mtu = " . $if->mtu . "\n";
print "metric = " . $if->metric . "\n";
print "index = " . $if->index . "\n";
print "is running\n" if $if->is_running;
print "is broadcast\n" if $if->is_broadcast;
print "is p-to-p\n" if $if->is_pt2pt;
print "is loopback\n" if $if->is_loopback;
print "is promiscuous\n" if $if->is_promiscuous;
print "is multicast\n" if $if->is_multicast;
print "is notrailers\n" if $if->is_notrailers;
print "is noarp\n" if $if->is_noarp;
}
and the result is like:
interface = re0
addr = 172.21.100.29
broadcast = 172.21.100.255
netmask = 255.255.255.0
Use of uninitialized value in concatenation (.) or string at int.pl li
+ne 15
dstaddr =
hwaddr = c8:0a:a9:93:87:25
mtu = 1500
metric = 0
index = 6
is running
is broadcast
is multicast
Your vendor has not defined IO::Interface macro IFF_NOTRAILERS at /usr
+/local/lib/perl5/site_perl/5.14.2/mach/IO/Interface/Simple.pm line 11
+7
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|