NAME
Tree::Range::conflict – override range_set
, so that it fails instead of writing over
SYNOPSIS
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));
DESCRIPTION
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.)
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.
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.)
SEE ALSO
Tree::Range::base, Tree::Range::RB::Conflict
AUTHOR
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.