Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Read network configuration on FreeBSD

by aitap (Deacon)
on Oct 10, 2012 at 17:38 UTC ( #998271=note: print w/replies, xml ) Need Help??


in reply to Read network configuration on FreeBSD

Actually, it doesn't work on Linux, too.

Notice the difference: the interfaces you get are strings, the ones you need are IO::Interface::Simple objects:

use Data::Dumper; use IO::Socket; use IO::Interface::Simple; print Dumper [ IO::Socket::INET::->new(Proto => 'udp')->if_list ]; print Dumper [ IO::Interface::Simple::->interfaces ]; print [IO::Interface::Simple::->interfaces]->[0]->address; __END__ $VAR1 = [ 'eth0', 'lo', 'teredo' ]; $VAR1 = [ bless( { 'name' => 'lo', 's' => bless( \*Symbol::GEN1, 'IO::Socket::INET' ) }, 'IO::Interface::Simple' ), bless( { 'name' => 'eth0', 's' => $VAR1->[0]{'s'} }, 'IO::Interface::Simple' ), bless( { 'name' => 'teredo', 's' => $VAR1->[0]{'s'} }, 'IO::Interface::Simple' ) ]; 127.0.0.1

Sorry if my advice was wrong.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://998271]
help
Chatterbox?
[GotToBTru]: ugh. Thanks Corion
[shmem]: meh. setting up a SIG{__DIE__} before loading Net::SSLeay still triggers Can't locate object method "tid" via package "threads" at /usr/share/perl/5. 20/XSLoader.pm
[choroba]: setting in a BEGIN block?

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2017-07-26 15:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (396 votes). Check out past polls.