August 1999 Perl Hardware Store Slide #15

Exporting Variables II

         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