如果 Perl 模块发生变化,plperlu 会重新加载它们吗?
如果我在 plperlu 中写了一些东西,并且它使用了 Perl 模块(例如 MyModule::Foo),那么该模块何时会被重新加载? 它是否像 mod_perl 的 Apache2::Reload 一样跟踪它们,以便触摸引起重新解释?
If I wrote something in plperlu, and it used a Perl module (e.g. MyModule::Foo), when would that module be reloaded? Does it keep track of them like mod_perl's Apache2::Reload, so that a touch will cause a reinterpretation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据 Leon 的评论进行一些测试后,显然 MyModule::Foo 从第一次成功使用时起就保留在内存中,但仅限于当前进程(即数据库句柄)。
如果编译它时出现错误(它将当您定义使用它的函数时抱怨)或使用它(例如,当您从函数中选择时),它会重新加载它。 但是,我看不到一种方法来强制它在成功运行后在进程中重新加载,即使是通过调用模块中出现错误的不同子程序也是如此。
另外,如果您通过 Apache::DBI 访问 PostgreSQL,这意味着您的缓存句柄将不会获取模块更改,除非您断开所有缓存句柄的连接。
所以我想没有办法在进程内强制进行检查,就像 Apache2::Reload...
After some testing based on what Leon commented, apparently MyModule::Foo stays in memory from the first time it gets used successfully, but only within the current process (i.e., database handle.)
If there were errors in either compiling it (it would complain when you defined a function that use'd it) or using it (when you select from your function, for example), it'll reload it. However, I can't see a way to force it to reload within a process once it successfully runs, even by calling a different sub in the module that does error out.
Also, if you're accessing PostgreSQL via Apache::DBI, this means your cached handles won't pick up module changes unless you disconnect all the cached handles.
So I guess there's no way to force a check within a process, a la Apache2::Reload...