August 1999 | Perl Hardware Store | Slide #15 |
Look at this funky trick:
package Evaluator;
sub import { my %hash; my $name = shift || 'eval'; tie %hash => Evaluator; my $caller = caller; *{$caller . '::' . $name} = \%hash; 1; }
sub TIEHASH { bless {} => Evaluator; }
sub FETCH { $_[0]; }
Next | Copyright © 1998 M-J. Dominus |