NAME

Range::Object::Serial - Implements ranges of integer identificators

SYNOPSIS

use Range::Object::Serial;

# Create a new range
my $range = Range::Object::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.

LICENSE AND COPYRIGHT

Copyright (c) 2011-2017 Alex Tokarev <tokarev@cpan.org>.

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