Next The Perl Hardware Store DC.pm Version 14

Read-Only Constants Continued

        package constant;
        sub import {
          my $caller = caller;
          my $package = shift;
          while ($name = shift) {
            my $value = shift;
            *{$caller . '::' . $name} = sub () { $value };
          }
        }
        use constant PI        => 3,
                     e         => 2.71828182845904523536,
                     emptylist => [];


Next Copyright © 2003 M. J. Dominus