Subject: | Problem with add_constructor and inheritance |
IMO add_constructor is semi-broken.
If a have a base Class: MyApp and do
MyApp->add_constructor(retrieve_public,'some sql');
and a class inheriting from MyAll, MyAll::SpecialCase in which I want to set another constructor 'retrieve_public', via
MyApp::SpecialCase->add_constructor(retrieve_public,'some ohter sql');
Class::DBI croaks "$method already exists in $class"
This happens because add_costructor checks $class->can($method), when IMO it should check if there is a CODE-Typeglob (or whatever this is called) in the actual package.
The attached patch changes the behaviour of add_constructor to allow subclassing of constructors.
I didn't take a closer look if this problem occures in other comparable methods, too.
Message body not shown because it is not plain text.