OpenSRF.pm AUTOLOAD complicates testing / serves little purpose
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Evergreen |
Fix Released
|
Medium
|
Unassigned | ||
OpenSRF |
Fix Released
|
Medium
|
Unassigned |
Bug Description
OpenSRF.pm contains an AUTOLOAD handler which warns when unimplemented subs are called. The original purpose was to log calls to nonexistent subs to the opensrf logs. While this may be helpful, the fact that the AUTOLOAD results in a value of "1" (the result of the final warn()), nonexistent subs do not cause execution to stop. Instead, the code continues using a value of "1" as the result of the bogus call. This can result in very confusing problems, particularly when testing new code.
Removing the AUTOLOAD will allow Perl to produce similarly useful error messages while also stopping code execution (unless captured by an eval/try). For example, removing the AUTOLOAD on a test system produces the following error when calling a nonexistent sub, invoked from srfsh:
Received Exception:
Name: osrfMethodException
Status: *** Call to [open-ils.
Undefined subroutine &OpenILS:
-----
WARNING: Removing AUTOLOAD means any code which relies (intentionally or otherwise) on the lax nature of nonexistent sub handling in OpenSRF will now die with a fatal error, whereas before it may have limped along. Evergreen users, I'm talking to you! Of particular interest will be ensuring the open-ils.storage CDBI entries are kept in sync with the IDL (as needed), as this is a common cause of calls to nonexistent subs in Evergreen.
Patch coming shortly.
Changed in opensrf: | |
milestone: | 2.1.3 → none |
Changed in evergreen: | |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in opensrf: | |
status: | New → Triaged |
importance: | Undecided → Medium |
Changed in evergreen: | |
milestone: | none → 2.6.0-rc1 |
milestone: | 2.6.0-rc1 → none |
Changed in opensrf: | |
milestone: | none → 2.4.0-alpha |
Changed in evergreen: | |
milestone: | 2.5.7 → 2.5.6 |
Changed in evergreen: | |
status: | Fix Committed → Fix Released |
Changed in opensrf: | |
status: | Fix Committed → Fix Released |
Patch pushed to working/ user/berick/ lp1179660- kill-autoload