Next Tricks of the Wizards 133

Local Effects

     use SelectSaver;
     {  my $saver = SelectSaver->(FH);
        # FH is selected
     }
     # old handle is selected
     use Hook::LexWrap;
     {
        my $temporarily = wrap 'myfunction',
                            post => sub { print "[post:@_]\n" },
                            pre  => sub { print "[pre: @_]\n  "};
        # Function is wrapped
     }
     # Function is no longer wrapped


Next Copyright © 2003 M. J. Dominus