| |
---|
| | @EXPORT_OK = qw(Compact Coalesce Zero Ones V4mask V4net); |
---|
| | |
---|
| | @ISA = qw(Exporter NetAddr::IP::Lite); |
---|
| | |
---|
| | $VERSION = do { sprintf " %d.%03d", (q$Revision: 4.12 $ =~ /\d+/g) }; |
---|
| | $VERSION = do { sprintf " %d.%03d", (q$Revision: 4.13 $ =~ /\d+/g) }; |
---|
| | |
---|
| | =pod |
---|
| | |
---|
| | =head1 NAME |
---|
| |
---|
| | :old_storable |
---|
| | :old_nth |
---|
| | ); |
---|
| | |
---|
| | my $ip = new NetAddr::IP 'loopback'; |
---|
| | or |
---|
| | my $ip = new NetAddr::IP::Lite '127.0.0.1'; |
---|
| | or from a packed IPv4 address |
---|
| | my $ip = new_from_aton NetAddr::IP::Lite (inet_aton('127.0.0.1')); |
---|
| | or from an octal filtered IPv4 address |
---|
| | my $ip = new_no NetAddr::IP::Lite '127.012.0.0'; |
---|
| | |
---|
| | print "The address is ", $ip->addr, " with mask ", $ip->mask, "\n" ; |
---|
| | |
---|
| | if ($ip->within(new NetAddr::IP "127.0.0.0", "255.0.0.0")) { |
---|
| |
---|
| | =item C<-E<gt>new([$addr, [ $mask|IPv6 ]])> |
---|
| | |
---|
| | =item C<-E<gt>new6([$addr, [ $mask]])> |
---|
| | |
---|
| | =item C<-E<gt>new_no([$addr, [ $mask]])> |
---|
| | |
---|
| | =item C<-E<gt>new_from_aton($netaddr)> |
---|
| | |
---|
| | The first two methods create a new address with the supplied address in |
---|
| | C<$addr> and an optional netmask C<$mask>, which can be omitted to get |
---|
| |
---|
| | |
---|
| | B<new_from_aton> takes a packed IPv4 address and assumes a /32 mask. This |
---|
| | function replaces the DEPRECATED :aton functionality which is fundamentally |
---|
| | broken. |
---|
| | |
---|
| | The third method C<new_no> is exclusively for IPv4 addresses and filters |
---|
| | improperly formated |
---|
| | dot quad strings for leading 0's that would normally be interpreted as octal |
---|
| | format by NetAddr per the specifications for inet_aton. |
---|
| | |
---|
| | C<-E<gt>new6> marks the address as being in ipV6 address space even if the |
---|
| | format would suggest otherwise. |
---|
| | |
---|
| |
---|
| | |