Perl's explicit behavior is to iron out the constants in the branches left after the branch was trimmed, based on the broken state. Is this documented?
This outputs 1:
bash$ T="" perl -Tle '
use constant T=>$ENV{T};
use Scalar::Util qw/tainted/;
exit if T;
print tainted(0)'
It seems that the constant is 0spoiled, because everything after the exit (in the original problem it was a return) is in the branch, which remains after the branching, which occurred on the basis of the spoiled state. This is a very cool Perl taint mode feature, but I can't find the documentation anywhere. If the parameter is $ENV{T}not set or when the condition is on dynamic access to $ENV{T}, the constants are not corrupted.
By the way, the best answer that I know at this time about the supposed actual problem of software development, from which this question arises, about how to disable part of the taint-mode perl-mode source during development without infecting my constants, is , set a constant to a constant instead of a damaged environment variable, for example:
use constant DEBUG_MODE => ( $ENV{DEV_DEBUG} ? 1 : 0 );
source
share