NAME Tie::NumRange - Keeps a number within a range of values. SYNOPSIS use Tie::NumRange; tie my($chr), Tie::NumRange => ( 100, # initial 0, # min 255, # max ); $chr *= 3; # $chr is 255 $chr = -5; # $chr is 0 tie my($positive), Tie::NumRange => ( 1, 1, undef ); $positive = 2**16; # ok $positive = 0; # $pos is 1 tie my($wrap), Tie::NumRange::Wrap => ( 0, # initial 0, # min 10, # max ); while ($wrap < 10) { # 0, 3, 6, 9, 2, 5, 8, 1, 4, 7 $wrap += 3; } DESCRIPTION This module institutes a range of values for a number. The lower and upper bounds can be unlimited by passing `undef' in their place. `Tie::NumRange' Constructor tie $number, Tie::NumRange => ($init, $min, $max); If `$min' is `undef', the number has no lower bound. Likewise for `$max'. `Tie::NumRange::Wrap' Constructor tie $number, Tie::NumRange::Wrap => ($init, $min, $max); Neither range can be `undef'. The value will wrap around when it goes outside the stated bounds. AUTHOR Jeff "japhy" Pinyan CPAN ID: PINYAN japhy@pobox.com http://www.pobox.com/~japhy/