in reply to Re: Inheritence of a Constructor that uses a file-scoped lexical?
in thread Inheritence of a Constructor that uses a file-scoped lexical?

Well, that's all well and good, since it does solve the problem of making sure that the reference to %fields points to the one in the appropriate file, but it sort of recreates the original problem I was trying to solve.

The whole point of inheriting the constructor was that I had subclasses that were all using esentially the same code for a constructor, so why duplucate the code. If I made changes, I'd have to update each package, etc. Instead, inherit it. But that introduced the problem that started this thread.

Your solution creates an init method, which must now exist in the same file as the subclass, and thus much exist in the same file for each and every subclass. While it significantly reduces the amount of code that is reproduced in each module, it doesn't eliminate it entirely.

If I make init inheritable from the base clase though, then I run into the same problem again. The reference points to the hash in the wrong file. It seems to be a chicken and the egg problem. Perhaps file-scoped lexical isn't the right way to go, but then how else do I get the fields (a name I shall change now, thank you for the education) for each class set up if not through a file-scoped lexical?

  • Comment on Re: Re: Inheritence of a Constructor that uses a file-scoped lexical?