No such thing as a small change | |
PerlMonks |
Re: Are "use constant" constants really inlined?by haukex (Archbishop) |
on Jun 30, 2016 at 07:30 UTC ( [id://1166918]=note: print w/replies, xml ) | Need Help?? |
Hi Darkwing, From "Constant Functions" in perlsub (emphasis mine): Functions with a prototype of () are potential candidates for inlining. If the result after optimization and constant folding is either a constant or a lexically-scoped scalar which has no other references, then it will be used in place of function calls made without &. The documentation then goes on to show an example like the one you're asking about (note that use constant ... in the main program essentially causes the module to be executed inside a BEGIN block in the main program, see use). Athanasius already showed how to use B::Deparse to check if they are inlined. Hope this helps,
In Section
Seekers of Perl Wisdom
|
|