in reply to 5.10: Are scoped constants possible?

Without trying anything here is some psudocode as to how it might be pulled off:

package lexconstants; sub import { shift; my %h = @_; my $caller = caller; for my $name (keys %h) { *{$caller . "::$name"} = sub () { lexconstants::value($name) } unless defined &{$caller . "::$name"}; } $^H{lexconstants} = \ %h; } sub unimport { $^H{lexconstants} = undef; } sub value { my ($name) = @_; (caller(0))[10]{$name} or warn "Undefined constant $name..." }

Again this is just psudocode (thinking out loud). This also assumes I know how to use %^H properly. I know it doesn't handle everything that constant does and it could cause sub conflicts in regions where no constant should have been defined. But, if you are using lex constants whose names mask package subs, you are probably crazy anyway. And, of course, you don't get the benifits of constant folding.

Ted Young

($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)