Next | Tricks of the Wizards | 44 |
use constant PI => 3, e => 2.71828182845904523536, emptylist => [];
constant.pm uses a combination of the read-only techniques and exportation:
package constant;
sub import { my $caller = caller; my $package = shift; while ($name = shift) { my $value = shift; *{$caller . '::' . $name} = sub () { $value }; } }
Next | Copyright © 2003 M. J. Dominus |