NAME

Range::Extension - Implements ranges of specialized phone numbers

SYNOPSIS

use Range::Extension;

# Create a new range
my $range = Range::Extension->new('*00-*03; 0100-0103', '#999');

# Test if a value is in range
print "in range\n"     if  $range->in('*02');
print "not in range\n" if !$range->in('*999');

# Add values to range
$range->add('*04', '0104', '#998');

# Get full list of values
my @list = $range->range();
print join q{ }, @list;
# Prints:
# *00 *01 *02 *03 *04 0100 0101 0102 0103 0104 #998 #999

# Get collapsed string representation
my $string = $range->range();
print "$string\n";
# Prints:
# '*00-*04,0100-0104,#998-#999'

# Get range size
my $size = $range->size();
print "$size";                  # Prints: 12

DESCRIPTION

This module is intended to be used with ranges of internal (extension) phone numbers used in various PBX systems.

Phone numbers are digit strings but they are not true numeric values. For one, the number of digits as well as their values do matter, including leading zeroes; secondly, in some phone systems the leading 'digit' can be a star (*) or hash (#) sign. This module takes into account all these differences.

Note that this module is NOT intended to work with public phone numbers (NANP, E.164 etc).

METHODS

See Range::Object.

BUGS AND LIMITATIONS

There are no known bugs in this module. Please report problems to author, patches are welcome.

AUTHOR

Alexander Tokarev <tokarev@cpan.org>.

LICENSE AND COPYRIGHT

Copyright (c) 2011 Alexander Tokarev.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.