March 2002 Perl Hardware Store 12

2. Manual Importing and Exporting

A Module That Exports a Function

        use MyLogger;
        LOG("Try a bigger gun!");
         package MyLogger;
         # Always export `LOG':
         sub import {
           # Get name of calling package
           my $caller = caller;  
           *{$caller . '::LOG'} = \&LOG;
         }
         sub LOG { ... }


Next Copyright © 2002 M-J. Dominus