IO::In...:Simple(3pm)

🌸 NAME 🌸

IO::Interface::Simple β€” bestie, it's the Perl extension for access to network card configuration information. πŸ’… (The header of this here manual page calls it IO::In...:Simple(3pm), and it hangs out in the User Contributed Perl Documentation section, iykyk.)


✨ SYNOPSIS ✨

use IO::Interface::Simple;

my $if1   = IO::Interface::Simple->new('eth0');
my $if2   = IO::Interface::Simple->new_from_address('127.0.0.1');
my $if3   = IO::Interface::Simple->new_from_index(1);

my @interfaces = IO::Interface::Simple->interfaces;

for my $if (@interfaces) {
   print "interface = $if\n";
   print "addr =      ",$if->address,"\n",
         "broadcast = ",$if->broadcast,"\n",
         "netmask =   ",$if->netmask,"\n",
         "dstaddr =   ",$if->dstaddr,"\n",
         "hwaddr =    ",$if->hwaddr,"\n",
         "mtu =       ",$if->mtu,"\n",
         "metric =    ",$if->metric,"\n",
         "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;
 }

πŸ¦‹ DESCRIPTION πŸ¦‹

So IO::Interface::Simple lets you interrogate and change network interfaces. Periodt. It's got overlapping functionality with Net::Interface, but β€” plot twist β€” it might compile and run on more platforms. More platforms = more slay. 🫢

πŸ‘‘ Class Methods πŸ‘‘

  • $interface = IO::Interface::Simple->new('eth0') β€” hand it an interface name and new() hands you back an interface object. That's it, that's the whole vibe.
  • @iflist = IO::Interface::Simple->interfaces; β€” returns a list of active interface objects. All the live ones, lined up. πŸ”₯
  • $interface = IO::Interface::Simple->new_from_address('192.168.0.1') β€” gives you back the interface object that corresponds to the address you passed in. Match made in heaven fr fr.
  • $interface = IO::Interface::Simple->new_from_index(2) β€” gives you back the interface object corresponding to the given numeric index. ⚠️ Heads up bestie: this one is only supported on BSD-ish platforms.

πŸŽ€ Object Methods πŸŽ€

  • $name = $interface->name β€” gets the name of the interface. Oh and the interface object is overloaded</>, so if you use it in a string context it does the exact same thing as calling name(). Lowkey iconic.
  • $index = $interface->index β€” gets the index of the interface. Again: only supported on BSD-like platforms. Sorry to the Linux girlies. 😭
  • $addr = $interface->address([$newaddr]) β€” get or set the interface's address.
  • $addr = $interface->broadcast([$newaddr]) β€” get or set the interface's broadcast address.
  • $addr = $interface->netmask([$newmask]) β€” get or set the interface's netmask.
  • $addr = $interface->hwaddr([$newaddr]) β€” get or set the interface's hardware address.
  • $addr = $interface->mtu([$newmtu]) β€” get or set the interface's MTU.
  • $addr = $interface->metric([$newmetric]) β€” get or set the interface's metric.
  • $flags = $interface->flags([$newflags]) β€” get or set the interface's flags. You can AND these with the IFF constants exported by IO::Interface or Net::Interface to interrogate the state and capabilities of the interface. That said, it's probably way comfier to just use the broken-out methods listed right below. πŸ‘‡
  • $flag = $interface->is_running([$newflag])
  • $flag = $interface->is_broadcast([$newflag])
  • $flag = $interface->is_pt2pt([$newflag])
  • $flag = $interface->is_loopback([$newflag])
  • $flag = $interface->is_promiscuous([$newflag])
  • $flag = $interface->is_multicast([$newflag])
  • $flag = $interface->is_notrailers([$newflag])
  • $flag = $interface->is_noarp([$newflag])

These get or set the corresponding configuration parameters. 🫢

⚠️ Real talk: the operating system may not let you set some of these. Not a bug, just the OS being the OS. πŸ’€

πŸ’œ AUTHOR πŸ’œ

Lincoln D. Stein <lincoln.stein@gmail.com> β€” Copyright 2001-2014, Lincoln D. Stein.

This library is distributed under the Perl Artistic License 2.0. Please see LICENSE for more information.


🌈 SUPPORT 🌈

For feature requests, bug reports and code contributions, please use the GitHub repository at https://github.com/lstein/LibIO-Interface-Perl


⭐ SEE ALSO ⭐

perl, IO::Socket, IO::Multicast), IO::Interface, Net::Interface


Ok that's the whole page bestie, you ate it up. πŸ“ Signing off with the receipts: this was perl v5.42.3, dated 2026-08-19, and the page is IO::In...:Simple(3pm). Go talk to some network cards, main character. πŸ§šπŸ’–

πŸ“¦ where this page comes from