Tree::Range::conflict – override range_set, so that it fails instead of writing over
range_set
package Tree::Range::Foo::Conflict 0.022; require Tree::Range::conflict; require Tree::Range::Foo; push (our @ISA, qw (Tree::Range::conflict Tree::Range::Foo));
This class overrides the range_set method, adding a guard which raises an exception (i. e., dies) if the range being associated is already given a value or values other than the leftmost one (as determined by the range_free_p method.)
range_free_p
Consider, e. g.:
## assuming numeric (<=>) comparison function $rat->range_set (100, 200, "foo"); $rat->range_set (200, 300, "bar"); $rat->range_set (150, 250, "baz");
The last range_set invocation in the example above raises an exception if the class of $rat is a descendant of this one.
$rat
Note, however, that the range_set_over method is not overridden, so it’s still possible to overwrite an arbitrary range’s association, or to effectively “remove” one (by associating it with the leftmost value.)
range_set_over
Tree::Range::base, Tree::Range::RB::Conflict
Ivan Shmakov <oneingray@gmail.com>
This library is free software; you can redistribute it and/or modify it under the terms of the 3-clause BSD license, as included within the code.
To install Tree::Range, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tree::Range
CPAN shell
perl -MCPAN -e shell install Tree::Range
For more information on module installation, please visit the detailed CPAN module installation guide.