One of my students used
NetworkInfo::Discovery for similar purpose and he managed to hack up a pretty useful tool using it. So, give it a try! Although I myself have not tried it, he reported the modules to be pretty much usable.
The same result could have been easily obtained by you as well if giving the search term 'network discovery' for search.cpan.org...:-)