in reply to Class::Std problem

Howdy!

Your constructor (new) will need to do the heavy lifting. 'new' will need to check the list of objects it has already created to see if the given id is already in use so it can return that object instead of creating a new one.

In essence, you want to establish a registry of objects. A hash whose keys are the 'id' values would do the trick. 'new' will first check the hash and create a new instance only if it's not already in the hash.

You are looking for what the Gang of Four calls the Flyweight pattern.

yours,
Michael