NAME
Range::Serial - Implements ranges of integer identificators
SYNOPSIS
use Range::Serial;
# Create a new range
my $range = Range::Serial->new('1-10, 12, 15', 17..20);
# Test if a value is in range
print "in range\n" if $range->in(5);
print "not in range\n" if !$range->in(11);
# Add values to range
$range->add(11, '13-14;16');
# Get full list of values
my @list = $range->range();
print join q{ }, @list; # Prints 1 2 3 4 5 ... 20
# Get collapsed string representation
my $string = $range->range();
print "$string\n"; # Prints '1-20'
# Get range size
my $size = $range->size();
print "$size"; # Prints: 20
DESCRIPTION
This module implements ranges of positive integer numbers that can be used as object identifiers.
METHODS
See Range::Object.
BUGS AND LIMITATIONS
Only positive integer numbers are supported. No backward ranges are supported, i.e. while '1-10' is valid range, '10-1' is not.
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.