0
|
1 package Tree::Interval::Node::Constants;
|
|
2
|
|
3 use strict;
|
|
4 use Carp;
|
|
5 use vars qw( $VERSION @EXPORT );
|
|
6
|
|
7 $VERSION = '0.1';
|
|
8
|
|
9 require Exporter;
|
|
10 *import = \&Exporter::import;
|
|
11
|
|
12 my @Node_slots;
|
|
13 my @Node_colors;
|
|
14
|
|
15 BEGIN {
|
|
16 @Node_slots = qw(PARENT LEFT RIGHT COLOR KEY VAL MAX INTERVAL);
|
|
17 @Node_colors = qw(RED BLACK);
|
|
18 }
|
|
19
|
|
20 @EXPORT = (@Node_colors, map {"_$_"} @Node_slots);
|
|
21
|
|
22 use enum @Node_colors;
|
|
23 use enum @Node_slots;
|
|
24
|
|
25 # enum doesn't allow symbols to start with "_", but we want them
|
|
26 foreach my $s (@Node_slots) {
|
|
27 no strict 'refs';
|
|
28 *{"_$s"} = \&$s;
|
|
29 delete $Tree::RB::Node::Constants::{$s};
|
|
30 }
|
|
31
|
|
32 1;
|