Zane C. Bowers-Hadley

NAME

Net::DHCP::Config::Utilities::Subnet - Represents a subnet.

VERSION

Version 0.0.1

SYNOPSIS

    use Net::DHCP::Config::Utilities::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 );

METHODS

new

This initiates the object.

    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 );

base_get

This returns the base IP for the subnet.

    my $base_IP=$subnet->base;

cidr

Returns the CIDR for the subnet.

    my $cidr=$subnet->cidr;

desc_get

Returns the description.

If this was not defined when initialized, '' will be returned.

    my $desc=$subnet->desc_get;

mask_get

This returns the current subnet mask.

    my $mask=$subnet->mask;

option_get

This returns the requested option.

If the requested option is not set, undef is returned.

Options are always saved internally using the short name, so if an option has both a long name and shortname, then the short name is used.

    my $option_value=$subnet->option_get( $option );
    if ( !defined( $option_value ) ){
        print $option." is not set\n";
    }

options_list

This list options that have been set, excluding mask.

    my @options=$subnet->options_list;

option_set

This sets an option.

Two arguments are taken. The first is the option and the second is the value. If the value is left undefined, then the option is deleted.

    eval{
         $subnet->option_set( $option, $value );
    };
    if ( $@ ){
        warn( 'Failed to set option "'.$option.'" with value "'.$value.'"... error='.$@ );
    }

range_get

This returns a array with containing the ranges in questions.

    my @ranges=$subnet->get_ranges;
    foreach my $range ( @range ){
       print "range ".$range.";\n"
    }

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)