Const-Dual
view release on metacpan or search on metacpan
lib/Const/Dual.pm view on Meta::CPAN
print "FALSE is ", FALSE ? "true" : "false"; # FALSE is true
=cut
BEGIN {
# forbid utf8 constant names on old perl
*_DOWNGRADE = $] >= 5.008 && $] < 5.015004 ? sub { 1 } : sub { 0 };
}
# some names are evil choices
my %forbidden = map { $_ => 1 } qw/BEGIN INIT CHECK UNITCHECK END DESTROY AUTOLOAD/, qw/STDIN STDOUT STDERR ARGV ARGVOUT ENV INC SIG/;
sub import {
my $class = shift;
my $storehash = ref $_[0] ? shift : undef;
Carp::croak "Only hashref accepted to store constants" if $storehash && ref $storehash ne 'HASH';
Carp::croak "Odd number of elements provided" if @_ % 2;
while (@_) {
my ($name, $value) = splice @_, 0, 2;
( run in 0.341 second using v1.01-cache-2.11-cpan-748bfb374f4 )