NAME

Config::IPFilter::Rule - A single block of IP addresses

Synopsis

use Config::IPFilter::Rule;
my $rule =
    Config::IPFilter::Rule->new(access_level => 255,
                                lower        => '0.0.0.0',
                                upper        => '255.255.255.255',
                                description  => 'teh innernetz'
    );

# Hide in a cave
$rule->set_access_level(126);

IPv6 is also supported...

use Config::IPFilter::Rule;
my $rule = Config::IPFilter::Rule->new(
       access_level => 255,
       upper        => 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
       lower        => '::',  # ojai
       description  => 'teh innernetz'
);

# Hide in a cave
$rule->set_access_level(126);
$filter->is_banned('2001:db8::');    # It, and everything else, is banned

Description

This is a single range of addresses (IPv4 or IPv6) which all share a single access level.

my $rule = Config::IPFilter::Rule->new( ... )

This constructs a new object. The following arguments are required:

access_level

This is an integer value.

description

This is a string. You should put the reason why this range exists here.

upper

This is the address at the highest end of this range.

lower

This is the address at the lowest end of this range.

$filter->access_level( )

Returns the access level currently defined for this range. See Config::IPFilter->is_banned( ... ).

$filter->set_access_level( $value )

Sets the access level for this range.

$filter->increase_access_level( [ $inc ] )

Sets the access level for this range $inc degrees higher. The default value of $inc is 1.

$filter->decrease_access_level( [ $dec ] )

Sets the access level for this range $dec degrees lower. The default value of $dec is 1.

$filter->in_range( $address )

If the given address is within this rule's range, a true value is returned otherwise a false value is returned.

$filter->description( )

This is original string value you passed during construction.

$filter->upper( )

This returns the address at the highest end of the range.

$filter->lower( )

This returns the address at the lowest end of the range.

Author

Sanko Robinson < sanko@cpan.org > - http://sankorobinson.com/

CPAN ID: SANKO

License and Legal

Copyright (C) 2010, 2011 by Sanko Robinson <sanko@cpan.org>

This program is free software; you can redistribute it and/or modify it under the terms of The Artistic License 2.0. See the LICENSE file included with this distribution or notes on the Artistic License 2.0 for clarification.

When separated from the distribution, all original POD documentation is covered by the Creative Commons Attribution-Share Alike 3.0 License. See the clarification of the CCA-SA3.0.

Neither this module nor the Author is affiliated with BitTorrent, Inc.