Net::CDP::IPPrefix - Cisco Discovery Protocol (CDP) IP prefix object
use Net::CDP::IPPrefix; # Constructors $prefix = new Net::CDP::IPPrefix($cidr); $prefix = new Net::CDP::IPPrefix($network, $mask); $prefix = new Net::CDP::IPPrefix($network, $length); $cloned = clone $prefix; # Object methods $cidr = $prefix->cidr; $network = $prefix->network; $mask = $prefix->mask; $length = $prefix->length;
A Net::CDP::IPPrefix object represents a single entry in the IP Prefixes field of a CDP packet. Net::CDP::IPPrefix objects are immutable.
$prefix = new Net::CDP::IPPrefix($cidr) $prefix = new Net::CDP::IPPrefix($network, $mask) $prefix = new Net::CDP::IPPrefix($network, $length)
Returns a new Net::CDP::IPPrefix object.
If only one argument is provided, new will attempt to parse it as an IPv4 network prefix in CIDR notation (eg, "192.168.0.0/24"), or as a prefix/netmask pair (eg, "192.168.0.0/255.255.255.0").
new
Alternatively, you can provide two arguments to supply the network prefix and mask or bit length separately.
$cloned = clone $prefix
Returns a deep copy of the supplied Net::CDP::IPPrefix object.
$cidr = $prefix->cidr()
Returns the IP prefix in CIDR notation (eg, "192.168.0.0/24").
$cidr = $prefix->network()
Returns the network component of this IP prefix (eg, "192.168.0.0").
$cidr = $prefix->mask()
Returns the mask component of this IP prefix as dotted-quad (eg, "255.255.255.0").
$cidr = $prefix->length()
Returns the bit length of the mask component of this dotted-quad (eg, 24).
Net::CDP
Michael Chapman, <cpan@very.puzzling.org>
Copyright (C) 2005 by Michael Chapman
libcdp is released under the terms and conditions of the GNU Library General Public License version 2. Net::CDP may be redistributed and/or modified under the same terms as Perl itself.
To install Net::CDP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::CDP
CPAN shell
perl -MCPAN -e shell install Net::CDP
For more information on module installation, please visit the detailed CPAN module installation guide.