NAME

Number::Nary - encode and decode numbers as n-ary strings

VERSION

version 0.01

$Id$

SYNOPSIS

This module lets you convert numbers into strings that encode the number using the digit set of your choice.

FUNCTIONS

n_codec($digits)

my ($encode_sub, $decode_sub) = n_codec('012'); # trinary

This routine returns a reference to a subroutine which will encode numbers into the given set of digits and a reference which will do the reverse operation.

This routine will croak if the digit string contains repeated digits.

The encode sub will croak if it is given input other than a non-negative integer.

The decode sub will croak if given a string that contains characters not in the digit string.

n_encode($value, $digits)

This encodes the given value into a string using the given digit string. It is written in terms of n_codec, above, so it's not efficient at all for multiple uses in one process.

This routine is not exported by default.

n_decode($value, $digits)

This is the decoding equivalent to n_encode, above.

This routine is not exported by default.

AUTHOR

Ricardo Signes, <rjbs at cpan.org>

BUGS

Please report any bugs or feature requests to bug-number-nary@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Number-Nary. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

ACKNOWLEDGEMENTS

COPYRIGHT & LICENSE

Copyright 2005 Ricardo Signes, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.