Next Hook::LexWrap 6

Examples of Tricky Features

Memoization

     my %cache;        
     wrap 'myfunction', 
        pre => sub { $_[-1] = $cache{$_[0]} if defined $cache{$_[0]} },
       post => sub { $cache{$_[0]} = $_[-1] };


Next Copyright © 2003 M. J. Dominus