Problems? Is your data what you think it is? | |
PerlMonks |
Moose "immutabilize" Best Practiceby kcott (Archbishop) |
on Dec 20, 2020 at 23:40 UTC ( [id://11125515]=perlquestion: print w/replies, xml ) | Need Help?? |
kcott has asked for the wisdom of the Perl Monks concerning the following question: Moose::Manual::BestPractices shows the following example in the "namespace::autoclean and immutabilize" section:
Some discussion follows which includes: "This is preferred to placing no Moose at the end of your package". I'm currently working through some rather old code (maybe 8-10 years old) which I haven't used in about 5 years. One module was working fine and still does — it didn't need much attention — and I mainly just tidied up the documentation and added some tests. After testing, I installed the new version and thought that was it. Today, while working on another module of similar vintage, I happened upon the Moose::Manual::BestPractices document. What I read didn't seem to gel with what I remembered from the code I'd put to bed a day or two ago. It looks more like this:
I'm reasonably certain I probably would have followed some sort of best practice advice when I wrote that code; although, I really don't remember where that advice might have come from. I'm also aware that best practices change over time: perhaps what was good for Moose in 2010 is less good in 2020. I'm interested in people's thoughts and opinions on this. What goes on behind the scenes with things like make_immutable is something of a black box to me: information such as "... allows Moose to speed up a lot of things ..." doesn't really help much. I'd like to find out more about this. Pointers to other documentation (instead of writing lengthy posts) are more than welcome. Thanks in advance. — Ken
Back to
Seekers of Perl Wisdom
|
|