in reply to Re: perl 5.38: can the body of a class declaration contain arbitrary code?
in thread perl 5.38: can the body of a class declaration contain arbitrary code?
Code in a class block behaves like code in a package block: It is evaluated once.
Ok, thanks. I can see the reason for that. Principle of least surprise. But I was kinda hoping they had gone for something like Scala's semantics, where all code in the class definition outside of methods constitutes the constructor.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: perl 5.38: can the body of a class declaration contain arbitrary code?
by haj (Vicar) on Jul 05, 2023 at 14:40 UTC | |
by jdporter (Paladin) on Jul 05, 2023 at 18:59 UTC | |
by haj (Vicar) on Jul 05, 2023 at 22:18 UTC | |
by jdporter (Paladin) on Jul 05, 2023 at 22:35 UTC | |
by cavac (Prior) on Jul 07, 2023 at 09:34 UTC |