Net::DHCP::Config::Utilities - Utility for helping generate configs for DHCP servers and manage subnets.
Version 0.0.1
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";
This iniates the object. No arguments are taken and this will always succeed.
my $dhcp_util = Net::DHCP::Config::Utilities->new;
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' ); }
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( $@ ); }
Returns a list of the subnet bases.
my @subnets=$dhcp_util->subnet_list;
Zane C. Bowers-Hadley, <vvelox at vvelox.net>
<vvelox at vvelox.net>
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.
bug-net-dhcp-config-utilities at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Net::DHCP::Config::Utilities
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
https://rt.cpan.org/NoAuth/Bugs.html?Dist=Net-DHCP-Config-Utilities
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Net-DHCP-Config-Utilities
CPAN Ratings
https://cpanratings.perl.org/d/Net-DHCP-Config-Utilities
Search CPAN
https://metacpan.org/release/Net-DHCP-Config-Utilities
Git Repository
https://github.com/VVelox/Net-DHCP-Config-Utilities
This software is Copyright (c) 2019 by Zane C. Bowers-Hadley.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install Net::DHCP::Config::Utilities, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::DHCP::Config::Utilities
CPAN shell
perl -MCPAN -e shell install Net::DHCP::Config::Utilities
For more information on module installation, please visit the detailed CPAN module installation guide.