[Koha-bugs] [Bug 35133] Accessors defined in AUTOLOAD does not work if called with SUPER

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Oct 23 17:38:02 CEST 2023


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=35133

--- Comment #1 from David Gustafsson <glasklas at gmail.com> ---
If overriding a accessor method in a child class of Koha::Object, and calling
parent by invoking $self->SUPER->accessor_name, $AUTOLOAD in the AUTOLOAD
method of KOHA::Object will be assigned the value 
Koha::ChildClass::SUPER::accessor_name instead of
Koha::ChildClass::accessor_name. The next time $self->SUPER->accessor_name is
called it will not be picked up, and AUTOLOAD will run again with a
SubroutineKoha::ChildClass::SUPER::accessor_name  redefined" warning, so
obviously definition of lazy accessors does not work for those cases.

I tried digging around to see if there is some way of defining autoloaded
accessors that handles this case, but unfortunately did not find any relevant
information on this. The only, probably safe, workaround is to not insert an
entry into the dispatch table when $AUTOLOAD contains '::SUPER::', so until we
have a better solution I think that probably is the way to go.

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list