https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28655
--- Comment #5 from David Cook <[email protected]> --- Comment on attachment 122574 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=122574 use Module-Pluggable as Plugin infrastructure Review of attachment 122574: --> (https://bugs.koha-community.org/bugzilla3/page.cgi?id=splinter.html&bug=28655&attachment=122574) ----------------------------------------------------------------- ::: Koha/Object.pm @@ +110,5 @@ > + my $ok = Koha::ObjectHooks->new(); > + my @plugins = $ok->plugins(); > + foreach my $plugin (@plugins) { > + $plugin->run(); > + } Running this code in _new_from_dbic() isn't scalable. If you fetched 1000 biblios, you'd be running this code 1000 times (at least). Since you're looking to wrap subs, it would be more performant to do this at compile time ran than run time (although that would mean it would be less dynamic but dynamic plugins are problematic anyway in a persistent (eg Plack) context). -- Also, this code won't work in all contexts. If Koha::Patron hasn't been loaded into memory, you'll get the following fatal error: "Can't wrap non-existent subroutine Koha::Patron::fixup_cardnumber". It works in your example, but it has a race condition which would break in unexpected ways. That said, the way around that would be to make your plugins specific to the Koha::Object you're trying to use, so that when you load Koha::Patron, you're just fetching plugins for 'Koha::Patron' so you can always count on it being loaded. But probably solvable. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
