Net::Silk::IPAddr - SiLK IP addresses
use Net::Silk::IPAddr;
my $ipv4 = Net::Silk::IPAddr->new("1.2.3.4");
my $ipv6 = Net::Silk::IPAddr->new("::ffff:1.2.3.4");
$ipv4->is_ipv6; # false
$ipv6->is_ipv6; # true
$ipv4 = Net::Silk::IPv4Addr->new("::ffff:1.2.3.4");
$ipv6 = Net::Silk::IPv6Addr->new("1.2.3.4");
$ipv4->is_ipv6; # false
$ipv6->is_ipv6; # true
my $ip = $ipv4->mask('255.255.255.0');
Net::Silk::IPAddr
represents an IPv4 or IPv6 address. These manifest as the subclasses Net::Silk::IPv4Addr
and Net::Silk::IPv6Addr
, respectively.
Returns an IP address object. The given spec can be a string representation of the address or another IP address object. Returns either a Net::Silk::IPv4Addr
or a Net::Silk::IPv6Addr
if the string appears to be an IPv6 address and SILK_IPV6_ENABLED is true.
Returns the string representation of this IP address. This method is tied to the ""
operator.
Returns the zero-padded string representation of this IP address.
Returns a list of octets representing this IP address.
Returns the integer representation of this IP address.
Returns true if this is a Net::Silk::IPv6Addr
.
Return a Net::Silk::IPv4Addr
representation of this address if possible.
Return a Net::Silk::IPv6Addr
representation of this address.
Return a copy of this address masked by the provided IP address mask.
Return the two character country code associated with this address if available.
Return an IPv4 address from the given integer. Also accepts hex string representations, e.g. "0xffffffff"
Return a copy of this address masked by the CIDR prefix bits. All bits below the prefixth bit will be set to zero. The maximum value for prefix is 32 for IPv4.
Return an IPv6 address from the given integer. Also accepts a hex string representation, e.g. "0xffff01020304"
Return a copy of this address masked by the given CIDR prefix bits. All bits below the prefixth bit will be set to zero. The maximum value for prefix is 128 for IPv6.
The following operators are overloaded and work with Net::Silk::IPAddr
objects:
"" 0+
-= -
+= +
> gt
< lt
>= ge
<= le
== eq
!= ne
<=> cmp
& |
= bool
<< >>
<<= >>=
~
Net::Silk, Net::Silk::RWRec, Net::Silk::IPSet, Net::Silk::Bag, Net::Silk::Pmap, Net::Silk::IPWildcard, Net::Silk::Range, Net::Silk::CIDR, Net::Silk::TCPFlags, Net::Silk::ProtoPort, Net::Silk::File, Net::Silk::Site, silk(7)
Copyright (C) 2011-2016 by Carnegie Mellon University
Use of the Net-Silk library and related source code is subject to the terms of the following licenses:
GNU General Public License (GPL) Rights pursuant to Version 2, June 1991 Government Purpose License Rights (GPLR) pursuant to DFARS 252.227.7013
NO WARRANTY
See GPL.txt and LICENSE.txt for more details.