Next | Tricks of the Wizards | 18 |
package Cookout;
sub import { my $caller = caller; *{$caller . '::grill'} = \&grill; }
sub grill { ... }
This module exports the function grill into the calling package:
use Cookout; # Calls Cookout->import() grill('kebabs'); # Calls Cookout::grill('kebabs')
$caller . '::grill' turns into main::grill
Now you know how the Exporter works
Next | Copyright © 2003 M. J. Dominus |