The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::CDP::IPPrefix - Cisco Discovery Protocol (CDP) IP prefix object

SYNOPSIS

  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;

DESCRIPTION

A Net::CDP::IPPrefix object represents a single entry in the IP Prefixes field of a CDP packet. Net::CDP::IPPrefix objects are immutable.

CONSTRUCTORS

new
    $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").

Alternatively, you can provide two arguments to supply the network prefix and mask or bit length separately.

clone
    $cloned = clone $prefix

Returns a deep copy of the supplied Net::CDP::IPPrefix object.

OBJECT METHODS

cidr
    $cidr = $prefix->cidr()

Returns the IP prefix in CIDR notation (eg, "192.168.0.0/24").

network
    $cidr = $prefix->network()

Returns the network component of this IP prefix (eg, "192.168.0.0").

mask
    $cidr = $prefix->mask()

Returns the mask component of this IP prefix as dotted-quad (eg, "255.255.255.0").

length
    $cidr = $prefix->length()

Returns the bit length of the mask component of this dotted-quad (eg, 24).

SEE ALSO

Net::CDP

AUTHOR

Michael Chapman, <cpan@very.puzzling.org>

COPYRIGHT AND LICENSE

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.