Re: Problem with my code for passing block
demerphq <[email protected]> Tue, 11 Jan 2022 10:55:54 +0100
| Newsgroups | gmane.comp.apache.mod-perl |
|---|---|
| Message-ID | <CANgJU+VRzLohCQohHZ4b-s46km53G_+tkrLwoMKtP4FF=pQZ5A@mail.gmail.com> |
On Tue, 11 Jan 2022 at 10:18, Yamadaえりな <[email protected]> wrote: > So, I would like to ask another question: > Is it safe to pass function reference to the caller (mostly it's the > method instantized from a class) in mod_perl development env? > Or should I avoid using this style? > Nothing wrong with passing code refs at all. It is common. Some folks prefer to pass *named* subroutines instead of anoymous ones. Eg: $thing->method(sub { "whatever" }); might turn into sub whatever { "whatever"; } $thing->method(\&whatever); this style will produce more comprehensible and easy to debug error messages. But tons of folks dont bother. Good luck. Yves