NAME
Net::IPAddress::Minimal - IP string to number and back
VERSION
Version 0.01
SYNOPSIS
This module converts IPv4 strings to integer IP numbers and vice versa.
It's built to be used as quickly and easily as possible, which is why you can just simply use the invert_ip function.
It recognizes whether you have an IPv4 string or a number and converts it to the other form.
Here's a sample script:
` use strict; use warnings;
use Net::IPAddress::Minimal ('invert_ip');
my $input_string = shift @ARGV;
my $output = invert_ip( $input_string );
print "$output\n";
`
EXPORT
Three functions can be exported:
invert_ip num_to_ip ip_to_num
SUBROUTINES/METHODS
invert_ip gets an IPv4 string or an IP number and converts it to the other form.
` my $ip_num = invert_ip( '10.200.10.130' ); # $ip_str = 180882050
my $ip_num = invert_ip( 180882050 );
# $ip_str = '10.200.10.130';
`
num_to_ip
Gets an IP number and returns an IPv4 string.
my $ip_num = num_to_ip( 3232235778 );
# $ip_str = '192.168.1.2';
ip_to_num
Gets a IPv4 string and returns the matching IP number.
** Note that at the moment this function does not ensure that each of the class numbers are between 0-255, and it can return unexpected results when misused **
my $ip_arrayref = '212.212.212.212';
my $ip_num = ip_to_num( $ip_arrayref );
# $ip_num = 3570717908
test_string_structure
Checks the structure of the input string and returns flags indicating whether it's an IPv4 string, and IP number or something else (which is an error).
AUTHORS
Tamir Lousky, <tlousky at cpan.org>
XSawyerX, <xsawyerx at cpan.org>
BUGS
Please report any bugs or feature requests to bug-net-ipaddress-minimal at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-IPAddress-Minimal. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc Net::IPAddress::Minimal
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-IPAddress-Minimal
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
ACKNOWLEDGEMENTS
LICENSE AND COPYRIGHT
Copyright 2010 Tamir Lousky.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.