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;