Range::Object::Extension - Implements ranges of specialized phone numbers
use Range::Object::Extension; # Create a new range my $range = Range::Object::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
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).
See Range::Object.
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.