Range::Object::String - Implements string collections with Range::Object API
use Range::Object::String; # Create a new collection my $range = Range::Object::String->new('foo bar', 'qux'); # Test if a value is in range print "in range\n" if $range->in('foo'); print "not in range\n" if !$range->in('baz'); # Add values to range $range->add('baz'); # Get sorted full list of values my @list = $range->range(); print join q{ }, @list; # Prints 'baz foo bar qux' # Get sorted list of strings separated with "\n" my $string = eval{ $range->range() }; print "$string" # Prints: baz # foo bar # qux # Get range size my $size = $range->size(); print "$size\n"; # Prints: 4
String ranges are not true ranges, more like collections. All strings in the "range" are separate values and can be never collapsed. Default separators are \r, \n and \t.
See Range::Object.
Input strings cannot contain line feeds, newline and tab characters as these are used as list separators.
There are no known bugs in this module. Please report problems to author, patches are welcome.
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.
To install Range::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Range::Object
CPAN shell
perl -MCPAN -e shell install Range::Object
For more information on module installation, please visit the detailed CPAN module installation guide.