NAME
Net::DHCP::Windows::Netsh::Parse - Parses the output from 'netsh dhcp server dump'
VERSION
Version 0.1.0
SYNOPSIS
use Net::DHCP::Windows::Netsh::Parse;
my $parser=Net::DHCP::Windows::Netsh::Parse->new;
eval{
$parser->parse( $dump );
};
if ( $@ ){
print "It failed with... ".$@."\n";
}
# no white space
my $json=$parser->json(0);
# now with useful white space
$json=$parser->json(0);
METHODS
new
This initiates the object.
No arguments are taken.
my $parser=Net::DHCP::Windows::Netsh::Parse->new;
parse
This parses a dump from netsh.
Only one option is taken and that is a string.
Nothing is returned. It will die if it fails to parse.
eval{
$parser->parse( $dump );
};
if ( $@ ){
print "It failed with... ".$@."\n";
}
hash_ref
This returns the current hash reference for the parsed data.
my $hash_ref=$parser->hash_ref;
json
This returns the parsed data as JSON.
One option is taken and that is either a 0/1 for if it should be made nice and pretty.
# no white space
my $json=$parser->json(0);
# now with useful white space
$json=$parser->json(0);
DATA STRUCTURE
The structure of it is as below for both the return hash ref or JSON.
$hostname=>{$scope}=>{
$options=>{
$option_id=>[]
},
mask=>subnet mask,
desc=>description,
}
The $option_id will always be numeric, except for one special case, which is range. That option contains a array of ranges that the scope in question uses with in that subnet. Each item the array represents one range. The format is as below for the string.
$start_ip $end_ip
Hostname will always have \\ removed, so \\winboot becomes just winboot.
$scope is going to be the base address of the subnet.
INTERNAL FUNCTIONS
add_options
This adds a option for a scope.
$hostname = Hostname of the DHCP server.
$scope = scope name
$option = DHCP option integer
$values = array ref of values
$parser->( $hostname, $scope, $option, \@values );
add_scope
This adds a new scope.
$hostname = Hostname of the DHCP server.
$scope = scope name
$mask = subnet mask for the scope
$desc = description
$parser->( $hostname, $scope, $mask, $desc );
AUTHOR
Zane C. Bowers-Hadley, <vvelox at vvelox.net>
BUGS
Please report any bugs or feature requests to bug-net-dhcp-windows-netsh-parse at rt.cpan.org
, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-DHCP-Windows-Netsh-Parse. 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::Windows::Netsh::Parse
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-Windows-Netsh-Parse
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
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)