in reply to Inheriting constants in the same file -- help me find a better way!
Well, you can skip Exporter.pm and constant.pm, since doing it yourself gives you more flexibility. For example:
But whether that is an improvement depends on a lot things, including taste. - tye (but my friends call me "Tye")use strict; BEGIN { my %consts= ( CA => 1, AZ => 2, UT => 3, ); while( my( $name, $value )= each %consts ) { no strict 'refs'; *{$_."::".$name}= sub () { $value } for qw( A B C D ); } } package A; print CA,$/; package B; print AZ,$/; package C; print UT,$/;
|
|---|