Help for this page

Select Code to Download


  1. or download this
    package Foo;
    
    ...
    warn "something happened" if DEBUG;
    
    warn "something interesting happened" if DEBUG > 1;
    
  2. or download this
    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;
    
  3. or download this
    # set DEBUG to 1 in package main
    % setenv DEBUG main
    ...
    # set DEBUG to 99 in all packages
    % setenv DEBUG all=99
    % perl foo.pl