Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Win32 Network Adapter module naming

by VinsWorldcom (Prior)
on Sep 22, 2017 at 13:25 UTC ( [id://1199912]=perlquestion: print w/replies, xml ) Need Help??

VinsWorldcom has asked for the wisdom of the Perl Monks concerning the following question:

UPDATE: Thanks for all the responses / advice. Module is now live on CPAN: Win32::Net::Info.

A while back I needed a Win32 module for getting network interface / adapter information much like IO::Interface or Net::Interface or Net::Libdnet .. but for Windows (obviously). Also, I know of Win32::IPConfig and Win32::IPConfig::Adapter which use the registry, but don't have all the functionality I needed. Finding nothing that suited at the time, I started to write one myself using XS and hitting the GetAdaptersAddresses() API and parsing the IP_ADAPTER_ADDRESSES structure, but alas my XS skills suck and I ended up writing a Perl interface around some 'wmic', 'netsh' and other Windows command line calls. Hey, it worked.

I thought about CPAN upload for a long while (years) and now I probably should, but what to name it? Originally, 'Win32::GetAdapterAddresses' would have been a good name, but I don't do the XS API integration so didn't want to misrepresent the functionality. It's currently called 'Win32::Interface' - which made sense since at the time, IO::Interface was mainly the functionality I was trying to duplicate. But now not so sure. How about ...

  • Win32::Interface - descriptive (for me), but thinking of others, I'm now not so sure. Also, I see Win32::API::Interface which is totally unrelated and I could cause confusion.
  • Win32::Adapter - maybe?
  • Win32::Network::Adapter - getting un-useful-ly long just to be overly descriptive
  • Win32::Network::Interface - same as above
  • IO::Interface::Win32 - I'm not actually sub-classing IO::Interface, so probably not a good idea
  • Net::Interface::Win32 - same as above
  • Win32::IO::Interface - just iterating names now ...
  • Win32::IO::Adapter - and again ...
  • Win32::Net::Interface - again ...
  • Win32::Net::Adapter - ...

Mainly, should it live under IO::, Net:: or Win32::, and then what name under the top level namespace? Suggestions? Maybe a Perlmonks Poll?!?

Replies are listed 'Best First'.
Re: Win32 Network Adapter module naming
by hippo (Bishop) on Sep 22, 2017 at 13:47 UTC

    From my reading of your post I'm drawing 2 conclusions:

    1. This is only a getter - it retrieves data from the O/S but never makes changes to the system/NICs
    2. It is highly Windows specific and is never intended to be of any use on other OSes

    If those both hold, I'd go for Win32::Net::Info. That's short and descriptive and with Win32 at the top it keeps the O/S wars from flaring up. JMHO.

      Your assumptions are correct - Windows only and it does not make changes (only gets current settings). I agree Win32:: should most likely be the top level - I like your suggestion. THANKS!

Re: Win32 Network Adapter module naming
by Discipulus (Canon) on Sep 22, 2017 at 14:00 UTC
    Hello VinsWorldcom,

    good news. I will be interested, even interested in the even if uncomplete XS works, just to figure how hard can be.

    Anyway as hippo said from the river's bed Win32:: is the better toplevel.

    Then is more matter of what you extract: if it is only like the ipconfig output also Win32::Ipconfig can be a choice.

    The proposed Win32::Net::Info also sounds good; but i dunno if Net sounds too generalist. Win32::Nic or Win32::Nic::Info can be a choice.

    Waiting your announcement, with the name you prefere!

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: Win32 Network Adapter module naming
by 1nickt (Canon) on Sep 22, 2017 at 15:06 UTC

    Win32::Network::Adapter - getting un-useful-ly long just to be overly descriptive

    Disagree. It's hard to imagine a name being "overly" descriptive ... the more specific it is, the better. Also, the closer it is to natural language, for searching to find it when you don't know what it's called.

    Also, I don't think this example is anywhere close to being un-usefully long. You only have to write it once after all.

    As to the actual name, I am not qualified to say, but hippo's suggestion as well as this one -- even Win32::Network::Adapter::Info if the only info it gives is about the network adapter -- make sense to me.

    </$0.02>


    The way forward always starts with a minimal test.

      Thanks!

      Nit-picking, but technically twice :-P

      use Win32::Really::Long::Module::Name::To::Get::Interface::Adapter::In +fo; ... my $if = Win32::Really::Long::Module::Name::To::Get::Interface::Adapte +r::Info->new();

      ... but point taken :-). Could always alias it as well. Three "levels" may be best - Win32::Net/Network::Interface/Adapter(::Info) - maybe optional fourth level of 'Info' in case someone wants to Win32::Net/Network::Interface/Adapter::Setter?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1199912]
Approved by haukex
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (5)
As of 2024-04-24 22:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found