NetAddr::IP::FastNew - NetAddr::IP new() methods with no validation
0.4
use NetAddr::IP::FastNew; my $ip = new NetAddr::IP::FastNew( '10.10.10.5' );
This module is designed to quickly create NetAddr::IP objects.
If you have a situation where you need 200_000 NetAddr::IP objects then the initialization speed can really become a problem.
Robert Drake, <rdrake@cpan.org>
Copyright (C) 2014 by Robert Drake
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.7 or, at your option, any later version of Perl 5 you may have available.
Right now this just calls NetAddr::IP->new().
my $ip = NetAddr::IP::FastNew->new("127.0.0.1");
Create a real NetAddr::IP from a single IPv4 address with almost no validation.
This only takes one argument, the single IP address. Anything else will fail in (probably) bad ways. Validation is completely up to you and is not done here.
my $ip = NetAddr::IP::FastNew->new_ipv4("127.0.0.1");
Create a real NetAddr::IP from a IPv4 subnet with almost no validation.
This requires the IP address and the subnet mask as it's two arguments. Anything else will fail in (probably) bad ways. Validation is completely up to the caller is not done here.
my $ip = NetAddr::IP::FastNew->new_ipv4_mask("127.0.0.0", "255.255.255.0");
Create a real NetAddr::IP object from a IPv4 cidr with almost no validation.
This requires the IP address and the cidr in a single argument. Anything else will fail in (probably) bad ways. Validation is completely up to the caller is not done here.
my $ip = NetAddr::IP::FastNew->new_ipv4_cidr("127.0.0.0/24");
Create a real NetAddr::IP object from an IPv6 subnet with no validation. This is almost as fast as the lazy object. The only caveat being it requires a cidr mask.
my $ip = NetAddr::IP::FastNew->new_ipv6("fe80::/64");
To install NetAddr::IP::FastNew, copy and paste the appropriate command in to your terminal.
cpanm
cpanm NetAddr::IP::FastNew
CPAN shell
perl -MCPAN -e shell install NetAddr::IP::FastNew
For more information on module installation, please visit the detailed CPAN module installation guide.