Help for this page
package Foo; ... warn "something happened" if DEBUG; warn "something interesting happened" if DEBUG > 1;
package Foo; use constant DEBUG => do {my $p=__PACKAGE__; ",$ENV{DEBUG}," =~ m/,($p +|all)(=(.*?))?,/s && ($2 ? $3 : 1) }; ... warn "something happened" if DEBUG; warn "something interesting happened" if DEBUG > 1;
# set DEBUG to 1 in package main % setenv DEBUG main ... # set DEBUG to 99 in all packages % setenv DEBUG all=99 % perl foo.pl