NAME

Net::DHCP::Config::Utilities - Utility for helping generate configs for DHCP servers and manage subnets.

VERSION

Version 0.1.0

SYNOPSIS

Please note that this only supports IPv4 currently.

use Net::DHCP::Config::Utilities;
use Net::DHCP::Config::Utilities::INI_loader;

my $dhcp_util = Net::DHCP::Config::Utilities->new;

# load stuff from a file
my $loader = Net::DHCP::Config::Utilities::INI_loader->new( $dhcp_util );
eval{
    $loader->load_file( $file );
};
if ( $@ ){
    # do something upon error
    die( $@ );
}

# create and add a new subnet
my $options={
             base=>'10.0.0.0',
             mask=>'255.255.255.0',
             dns=>'10.0.0.1 , 10.0.10.1',
             desc=>'a example subnet',
             };
my $subnet = Net::DHCP::Config::Utilities::Subnet->new( $options );
eval{
    $dhcp_util->subnet_add( $subnet );
};
if ( $@ ){
    # do something upon error
    die( $@ );
}

my @subnets=$dhcp_util->subnet_list;
print "Subnets:\n".join("\n", @subnets)."\n";

METHODS

new

This iniates the object. No arguments are taken and this will always succeed.

my $dhcp_util = Net::DHCP::Config::Utilities->new;

subnet_add

This adds a new Net::DHCP::Config::Utilities::Subnet object, provided it does not over lap any existing ones. If the same base/mask has been added previously, the new will over write the old.

One object is taken and that is the Net::DHCP::Config::Utilities::Subnet to add.

This will die upon failure.

eval{
   $dhcp_util->subnet_add( $subnet );
};
if ( $@ ){
    die( $@.' prevented the subnet from being added' );
}

subnet_get

This returns the requested the subnet.

One option is taken and that is the base of the subnet desired.

If the requested subnet is not found, this will die.

The returned value is a Net::DHCP::Config::Utilities::Subnet object.

my $subnet=$dhcp_util->subnet_get;
if ( $@ ){
    die( $@ );
}

subnet_list

Returns a list of the subnet bases.

my @subnets=$dhcp_util->subnet_list;

AUTHOR

Zane C. Bowers-Hadley, <vvelox at vvelox.net>

BUGS

Please report any bugs or feature requests to bug-net-dhcp-config-utilities at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-DHCP-Config-Utilities. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Net::DHCP::Config::Utilities

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2019 by Zane C. Bowers-Hadley.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)