* fergal@dyn.fergaldaly.com <fergal@dyn.fergaldaly.com> [2003-11-04 10:49]: > What else do you mean by "tightly scoped"? Something like this: * Orton, Yves <yves.orton@de.mci.com> [2003-11-03 17:34]: > use Scalar::Util qw(refaddr); > > { > my %attrib; > sub inside_out { > my $s=shift; > if (@_) { > $attrib{refaddr($s)}=shift; > return $s; > } else { > return $attrib{refaddr($s)}; > } > } > } I guess you can reduce the accessibility of the attribute by storing the closure ref in a lexical scoped like %attrib in the above code instead of exporting it to a named sub. I also guess I'm belabouring a minor point. -- Regards, Aristotle "If you can't laugh at yourself, you don't take life seriously enough."Thread Previous | Thread Next