Problems? Is your data what you think it is? | |
PerlMonks |
Autovivification with requireby Bod (Parson) |
on Nov 19, 2020 at 22:53 UTC ( [id://11123854]=perlquestion: print w/replies, xml ) | Need Help?? |
Bod has asked for the wisdom of the Perl Monks concerning the following question: Esteemed Monks Thanks to the The Monastery, I today found out about Perl::Critic so thought I would throw a recently written, small (600 lines) Perl script at it just for fun...so I used the website tool knowing that it would complain that scriptures were off. It has highlighted 12 issues amongst them: I've looked this up and understand what it is suggesting I do
I've consulted the documentation for require and I understand the portability advantage of the slash being the other way on some systems. As my code will never be run in another environment, I don't see the advantage of backdating the code for this reason but going forward, that makes sense. But then we get to autovivification... I do understand that the syntax I have used for require will not autovivify whereas the version suggested by Critic will. What I certainly do not understand is how this makes any practical difference in any way. Whether the magic happens at compile time or run time surely doesn't matter here as the code only runs once for each executed instance; which equates to someone (or some machine) requesting a page from the webserver. I totally get that in many cases there are major differences between compile and run time - but here in a require statement? Does it actually matter in practical terms or is autovivification in this example just a theoretical matter here?
Back to
Seekers of Perl Wisdom
|
|