Bugzilla – Attachment 161152 Details for
Bug 35133
Accessors defined in AUTOLOAD does not work if called with SUPER
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35133: Don't lazily define accessor methods when invoked through SUPER
Bug-35133-Dont-lazily-define-accessor-methods-when.patch (text/plain), 1.55 KB, created by
Emily Lamancusa (emlam)
on 2024-01-18 20:58:10 UTC
(
hide
)
Description:
Bug 35133: Don't lazily define accessor methods when invoked through SUPER
Filename:
MIME Type:
Creator:
Emily Lamancusa (emlam)
Created:
2024-01-18 20:58:10 UTC
Size:
1.55 KB
patch
obsolete
>From 57c2a748982a5a84cad24aa352c2fc3fa5100d94 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Mon, 23 Oct 2023 17:49:06 +0200 >Subject: [PATCH] Bug 35133: Don't lazily define accessor methods when invoked > through SUPER > >To test: > 1) Apply Bug 32476 > 2) Run tests in t/db_dependent/Patrons.t > 3) This should produce multiple "Subroutine Koha::Patron::SUPER::dateexpiry redefined at ..." warnings > 4) Apply patch > 5) Run tests in t/db_dependent/Patrons.t again > 6) The warnings in 3) should now no longer appear > >Signed-off-by: matthias le gac <matthias@babel.inlibro.net> >Signed-off-by: Phan Tung Bui <phan-tung.bui@inlibro.com> >Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov> >--- > Koha/Object.pm | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > >diff --git a/Koha/Object.pm b/Koha/Object.pm >index 6564ce948b..4086caf316 100644 >--- a/Koha/Object.pm >+++ b/Koha/Object.pm >@@ -1067,8 +1067,13 @@ sub AUTOLOAD { > return $self->_result()->get_column($method); > } > }; >- no strict 'refs'; ## no critic (strict) >- *{$AUTOLOAD} = $accessor; >+ # If called from child class as $self->SUPER-><accessor_name> >+ # $AUTOLOAD will contain ::SUPER which breaks method lookup >+ # therefore we cannot write those entries into the symbol table >+ unless ( $AUTOLOAD =~ /::SUPER::/ ) { >+ no strict 'refs'; ## no critic (strict) >+ *{$AUTOLOAD} = $accessor; >+ } > return $accessor->( $self, @_ ); > } > >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 35133
:
157678
|
157793
|
160777
|
160778
| 161152