in reply to Re: Smallish mock objects
in thread Smallish mock objects

You can have overlapping classes here. If $obj expires prior to this code executing again then you can have the same location-reused and you'd have the same class name for two different objects. Symbol does the work of maintaining a counter for me and applying it to a namespace. The following code is quite a bit lighter but it introduces the namespace Symbol::GEN1->GENinf.

my $counter = 0; sub new { my $class = "Symbol::GEN$counter"; ++ $counter; return bless ..., $class; }

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊