Net::Hacky::Detect::IP - Hackily try different methods of attaining local system IPs
Version 0.019
use Net::Hacky::Detect::IP; my $ip = Net::Hacky::Detect::IP->new(); my @ips = @{ $ip->scan() }; foreach my $host (@ips) { print "Detected ip: $host\n"; if ($ip->checkIP($host)) { print "IP is deffinetly usable! (Was tested twice as scan() auto checks)\n"; } }
Hackily concatenate output from multiple system commands then attempt to find valid ips from it, once found they are tested for connectability then returned. This is not pretty nor very clever but extracting system ips is a nightmare however you go about it and this method appears to be the more reliable.
Create a new object for interacting with Net-Hacky-Detect-IP
Attempt to find local system ips, 1 optional argument, of '4' or '6' designating wether to look for ipv4 or ipv6 addresses, if left blank search for both.
Returns a list of local ips for the system, will return a blank [] list if nothing found.
Check an IP is valid and usable, takes 1 mandatory argument;
Argument 1 Should be an ip address (not hostname)
Returns 1 on success 'valid' and 0 on failure 'invalid'
These functions are not yet working.
Return 1 if an address is a publically routed address.
Return 0 if it is not.
Return 1 if an address is a privately routed 'LAN' address.
Return 1 if an address can be bound to, to access the internet.
Paul G Webster, <daemon at cpan.org>
<daemon at cpan.org>
Please report any bugs or feature requests through the authors code repository at https://gitlab.com/paul-g-webster/PL-Net-Hacky-Detect-IP
https://gitlab.com/paul-g-webster/PL-Net-Hacky-Detect-IP
You can find documentation for this module with the perldoc command.
perldoc Net::Hacky::Detect::IP
You can also look for information at:
GitLab: The authors gitlab page for this project
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Net-Hacky-Detect-IP
CPAN Ratings
http://cpanratings.perl.org/d/Net-Hacky-Detect-IP
Search CPAN
http://search.cpan.org/dist/Net-Hacky-Detect-IP/
Thank you for all the continued help from irc.freenode.net #perl and irc.perl.org #perl
Copyright 2017 Paul G Webster.
This program is distributed under the (Simplified) BSD License: http://www.opensource.org/licenses/BSD-2-Clause
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
To install Net::Hacky::Detect::IP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Hacky::Detect::IP
CPAN shell
perl -MCPAN -e shell install Net::Hacky::Detect::IP
For more information on module installation, please visit the detailed CPAN module installation guide.