NAME
Net::DHCPv6::Option - DHCPv6 option base class
VERSION
version 0.001
SYNOPSIS
my $opt = Net::DHCPv6::Option->new(code => 99, data => "\x01\x02");
print $opt->code; # 99
print $opt->data; # raw bytes
print $opt->as_bytes; # TLV-encoded wire bytes
my ($opt, $remain) = Net::DHCPv6::Option->from_bytes($tlv_bytes);
DESCRIPTION
Base class for all DHCPv6 options. Stores a numeric option code and raw payload data. Subclasses provide typed accessors for specific option types.
ALPHA STATUS
ALPHA SOFTWARE. This is an early release. The interface is experimental and subject to change without notice.
METHODS
- new(code => $num, data => $bytes)
-
Constructor. Requires
code;datadefaults to empty string. - code
-
Returns the numeric option code.
- data
-
Returns the raw payload bytes.
- type
-
Returns the option name string (e.g.
CLIENTID) via reverse lookup, orundeffor unknown codes. - as_bytes
-
Serializes the option as a TLV: code(16) + length(16) + data.
- from_bytes($bytes)
-
Class method. Parses one option TLV from wire bytes. Returns
($option, $remaining_bytes). Dispatches to the appropriate subclass via%OPTION_CLASS. Falls back toOption::Genericfor unknown codes.
SUBCLASSING
Concrete option classes should:
- Override
newto accept typed attributes and setcode+data - Override
as_bytesif the wire format differs from standard TLV - Implement
from_bytes_inner($code, $data)for parse-from-wire - Register with
$Net::DHCPv6::OptionList::OPTION_CLASS{$code} = __PACKAGE__
SEE ALSO
Net::DHCPv6::OptionList, concrete option classes under Net::DHCPv6::Option
AUTHOR
Dean Hamstead <dean@fragfest.com.au>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2026 by Dean Hamstead.
This is free software, licensed under:
The MIT (X11) License