Why do I get “redefine” warnings with “use constant” under mod_perl?

懵懂的女人 提交于 2019-12-05 17:42:31

AFAIK, you only get these warnings when you modify your script and then the script is re-compiled by mod_perl for subroutines that are eligible for inlining. When the subroutine is recompiled, if the the value it returns changed, that new value would not be reflected in the places where it was previously inlined.

If you change the value of, say, BUFFER_SIZE, you should re-start apache.

I also think mod_perl / Apache::Registry accidental closures is relevant to your script.

At a guess, the first definition of FOO is being optimized away. Define it with a statement in the body and I think you'll find the error disappears.

$ perl -e 'sub FOO () { print 1; } BEGIN{ *FOO = sub () { 2 }; } print FOO;'

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!