in reply to Inheritance in Hash

I wouldn't use a hash for this application, I'd use objects. I needed something like this for XML::Validator::Schema's simple type library. In XML Schema, simple types are defined as a tree where each child node adds restrictions and inherits the behavior of its parent. I modeled this tree as a hash of objects which track their parent through composition.

For example, to instantiate the entry for nonPositiveInteger I call the derivation constructor (dervive()) on the integer object and then add a new restriction (that the value can't be greater than 0):

$BUILTIN{nonPositiveInteger} = $BUILTIN{integer}->derive(name => 'no +nPositiveInteger'); $BUILTIN{nonPositiveInteger}->restrict( maxInclusive => 0 );

You can see this code here: XML::Validator::Schema::SimpleType. I've found this to be an easy to maintain system which has grown smoothly as new types have been added by myself and others. It also makes supporting custom simple-types created by schemas easy.

-sam