enum::prefix
use enum::prefix BUG_ => qw(STATUS CLOSE FIXED REOPEN); # BUG_CLOSE = 0, BUG_FIXED = 1, BUG_REOPEN = 2; # BUG_STATUS(1) eq 'FIXED';
This module is used to define a set of constanst with ordered numeric values, and export a function for get the enum name by order, function name is the concatenation of first two arguments.
There are a number of modules that can be used to define enumerations: Class::Enum, enum::fields, enum::hash, Readonly::Enum, Object::Enum, Enumeration.
electricface
To install enum::prefix, copy and paste the appropriate command in to your terminal.
cpanm
cpanm enum::prefix
CPAN shell
perl -MCPAN -e shell install enum::prefix
For more information on module installation, please visit the detailed CPAN module installation guide.