| Next | The Perl Hardware Store | DC.pm Version | 14 |
constant.pm uses a combination of the read-only constant and exportation:
package constant;
sub import {
my $caller = caller;
my $package = shift;
while ($name = shift) {
my $value = shift;
*{$caller . '::' . $name} = sub () { $value };
}
}
How to use this?
use constant PI => 3,
e => 2.71828182845904523536,
emptylist => [];
But if you use the module, it loads 1289 lines of code
| Next | ![]() |
Copyright © 2003 M. J. Dominus |