http://www.perlmonks.org?node_id=895878


in reply to Re: Using constant to override (abstract) methods.
in thread Using constant to override (abstract) methods.

So you are asking 'Why?!'? That's why I like reading PM! :)

The example lacks some documentation that is included in the 'real' code, so I'm confident that my colleagues can deal with the code.

But more important and interessting: 'why'?

First of all: I don't claim that this is the best or most clever solution.

The motivation for this was, that we have a bunch of small classes with immutable values (like for example: error-classes).
You've got FileError, DatabaseError, FooError... all these errors share an errorCode, an errorText, an errorDescription and also a static list of errorFields which the error could affect.
So I decided to create an interface Error for these errors so that every error-class (which are using constants so far) really implements all constants.

k