Net::ISC::DHCPd::OMAPI - Talk to a dhcp server
This module provides an API to query and possible change the ISC DHCPd server. The module use OMAPI (Object Management API) which does not require the server to be restarted for changes to apply.
OMAPI is simply a communications mechanism that allows you to manipulate objects, which is stored in the dhcpd.leases file.
See subclasses for more information about the different objects you can manipulate: the Net::ISC::DHCPd::OMAPI::Failover manpage, the Net::ISC::DHCPd::OMAPI::Group manpage, the Net::ISC::DHCPd::OMAPI::Host manpage, and the Net::ISC::DHCPd::OMAPI::Lease manpage.
To enable debug output, execute this chunk of code before loading the module:
BEGIN { Net::ISC::DHCPd::OMAPI::_DEBUG = sub { 1 } }
$str = $self->server;
Returns the server address. Default is 127.0.0.1.
$int = $self->port;
Returns the server port. Default is 7911.
$str = $self->key;
Returns the server key: "$name $secret".
$str = $self->errstr;
Returns the last known error.
$bool = $self->connect;
Will open a connection to the dhcp server. Check $@
on failure.
$bool = $self->disconnect;
Will disconnect from the server.
$object = $self->new_object($type => %constructor_args);
$type
can be "group", "host", or "lease". Will return a new config object.
Example, with $type="host"
:
Net::ISC::DHCPd::Config::Host->new(%constructor_args);