App::EvalServerAdvanced::ConstantCalc - A basic bitwise calculator supporting bitwise operations
This module handles calculating bitwise expressions using constant values. Things like O_CREAT|O_RDWR|O_EXCL|O_CLOEXEC. Mainly intended to be used for parsing rules/values for Seccomp plugins for App::EvalServerAdvanced but does not depend on it.
All bitwise operators | & ~ and ^ are supported. Along with a special bitwise inverse with built in masking, ~[16] will negate all the bits, and apply a 16 bit mask to the resulting value.
You can predefine constants to be available to expressions so that you don't have to remember that O_RDONLY is 0, O_RDRW is 4. This means that your expressions can be made to show your intent rather than just some magic number.
Constructor, can take a single argument constants that is a has of any constants you want to define.
constants
Add a constant at runtime, takes two arguments $key and $value. Will prevent you from setting up invalid constants or ones with an invalid value.
$key
$value
Valid keys begin with /[a-z_]/i and are followed by /[a-z0-9_]/i. Valid values are any integer.
/[a-z_]/i
/[a-z0-9_]/i
Takes a $key gives back the corrosponding value for the constant. Most likely not useful for anybody, but used internally to do the lookup. Will die if the constant doesn't exist.
App::EvalServerAdvanced, Parser::MGC
Ryan Voots <simcop@cpan.org>
To install App::EvalServerAdvanced::ConstantCalc, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::EvalServerAdvanced::ConstantCalc
CPAN shell
perl -MCPAN -e shell install App::EvalServerAdvanced::ConstantCalc
For more information on module installation, please visit the detailed CPAN module installation guide.