mod_perl 与 Moose 配合得很好吗?
我开始学习 Perl 的基础知识,然后发现并学习了 Moose,用 Moose 编写了整个应用程序,结果发现它必须在 mod_perl 下运行。所以我用 mod_perl 将我的代码扔到服务器上,然后一大堆东西都出了问题。其一,会话信息已损坏,而本应超时的内容并未超时,还有一大堆其他问题。
除了剔除全局变量以使代码功能符合 mod_perl 中的预期之外,通常还需要发生什么? mod_perl 与 Moose 配合得很好吗? mod_perl 下的 Moose 是否有任何问题,或者我需要注意 mod_perl 中通常出现的奇怪的事情?
到目前为止我学到的一件事是,由于代码是在 Apache 名称空间中编译和创建的,因此全局变量实际上永远不会被销毁 - 并且您必须通过启动它们来清除它们=/
I started learning Perl with the basics, then discovered and learned Moose, wrote an entire application with Moose, only to discover it had to run under mod_perl. So I throw my code up on the servers with mod_perl, and a whole bunch of stuff is going wrong. For one the session information is corrupted and things that were supposed to timeout aren't -- and just a whole bunch of other problems.
What generally needs to happen beyond say culling global variables to make a code function as intended in mod_perl? Does mod_perl play nicely with Moose? Are there any gotchas with Moose under mod_perl, or weird things generally from mod_perl I need to look out for?
One thing I've learned so far is that since the code is compiled and created in an Apache namespace, the global variables never actually get destroyed -- and you have to clear them by initiating them =/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,Moose 就是 Perl。当然,任何在 mod_perl 下适用于非 Moose 代码的警告也适用于 Moose。
您提到的全局变量问题与 Moose 无关。
Yes, Moose is just Perl. Any caveats that apply under mod_perl with non-Moose code also apply to Moose, of course.
The issue with globals you mentioned have nothing to do with Moose.
我们非常愉快地使用 Moose 和 mod_perl。
我将重点指出一些上下文 - 这很常见...
我不能谈论内存泄漏等问题。我们有 MaxRequestsPerChild=1000,但我从来没有去过任何地方,没有将其设置为理智的东西。
我们的测试套件不涉及 Apache(Plack 帮助很大)。
We're using Moose with mod_perl quite happily.
I'll bullet-point some context - it's pretty common ...
I can't speak for memory leakage etc. We have MaxRequestsPerChild=1000, but I've never been anywhere where that wasn't set to something sane.
Our test suite doesn't touch Apache (Plack helps a lot).