in reply to Nested runtime warning disabling

warnings have lexical scope, so

no warnings; sub test_warnings { GenerateWarning(); AnotherSub(); } sub AnotherSub { GenerateWarning(); }

also, may be this code be useful for you

sub test_warnings { local $SIG{__WARN__} = sub {}; GenerateWarning(); AnotherSub(); }

Replies are listed 'Best First'.
Re^2: Nested runtime warning disabling
by kryten (Scribe) on Jul 26, 2004 at 21:34 UTC
    The problem with moving the 'no warnings' outside the test_warnings sub is that I will not get warnings when I call:
    sub another_test { AnotherSub(); }
    The local signal handler might work if I can just catch the class of error I'm trying to supress and 'pass through' everything else as normal.