[Koha-bugs] [Bug 15759] New: Allow Koha::Object derived objects to be used as hashrefs
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Feb 8 16:53:02 CET 2016
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15759
Bug ID: 15759
Summary: Allow Koha::Object derived objects to be used as
hashrefs
Change sponsored?: ---
Product: Koha
Version: unspecified
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P5 - low
Component: Architecture, internals, and plumbing
Assignee: gmcharlt at gmail.com
Reporter: kyle at bywatersolutions.com
QA Contact: testopia at bugs.koha-community.org
On occasion, bugs in Koha have been revealed to be a mis-use of Koha::Object.
This seems to be due to our long standing use of hashrefs for data in Koha.
For instance, a developer may accidentally write:
my $borrowernumber = $borrower->{borrowernumber};
instead of
my $borrowernumber = $borrower->borrowernumber;
Since our object is a blessed hashref, this does not cause an error. Instead,
we just access that key of the hashref, which is almost certainly undefined.
With some extra code in Koha/Object.pm, we can allow hashref-like use of our
Objects, which will not only prevent these errors, but allow drop-in use of
Koha::Objects where we currently use hashrefs!
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list