Strawberry Perl 和 mod_perl2 下出现奇怪的 Apache2::Cookie 错误
我有一组在 ActivePerl 5.10 下运行的脚本。但是,在 Strawberry Perl 5.10 下,我收到一条奇怪的错误消息:
Can't locate object method "cookie_class" via package "MyCookie" (perhaps you forgot to load "MyCookie"?) at C:/strawberry/perl/site/lib/Apache2/Cookie.pm line 41.
然而,MyCookie
是 cookie 本身的名称,而不是任何 Perl 包的名称。
如果我注释掉 Cookie.pm 的第 41 行,脚本会运行,但我无法再成功获取或设置 cookie。
错误消息似乎有些正确,因为我也找不到 cookie_class
(除了 POD 文件中提到的地方)。也就是说,我的 ActivePerl 安装也是如此。
我认为它在 C:\strawberry\perl\site\lib\auto\APR\Request\Request.dll
中——为什么在 Strawberry 下找不到它,但在 ActivePerl 下可以找到它?
I have a set of scripts that run under ActivePerl 5.10. However, under Strawberry Perl 5.10, I get a strange error message:
Can't locate object method "cookie_class" via package "MyCookie" (perhaps you forgot to load "MyCookie"?) at C:/strawberry/perl/site/lib/Apache2/Cookie.pm line 41.
However, MyCookie
is the name of the cookie itself, not any Perl package.
If I comment out line 41 of Cookie.pm, the script runs, but I cannot successfully get or set cookies anymore.
The error message seems somewhat correct in that I can't find cookie_class
either (except where it's mentioned in the POD files.) That said, the same is true for my ActivePerl installation.
I think it's in C:\strawberry\perl\site\lib\auto\APR\Request\Request.dll
--how come it can't find it under Strawberry, but can under ActivePerl?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
更改您的代码以使用 2.X 方案,如下所示:
而不是旧方法:(
出于某种原因,这似乎可以修复它。)
Change your code to use the 2.X scheme like so:
Rather than the old method:
(For some reason this seemed to fix it.)
您是否可能在 Strawberry 和 ActivePerl 版本之间混合使用 apreq DLL?或者以某种方式混合 apreq-1 和 apreq-2 DLL?
有问题的
cookie_class
调用周围的区域就是这样:cookie_class
方法确实来自Request.dll
和$req
在调用jar()
之前进行类型检查。Are you possibly mixing the apreq DLLs between the Strawberry and ActivePerl versions? Or mixing apreq-1 and apreq-2 DLLs somehow?
The area around the offending
cookie_class
call is just this:The
cookie_class
method does come fromRequest.dll
and$req
is type checked beforejar()
is called.在某个地方,您或其他人正在将字符串传递给需要对象的函数。调试的最佳第一步是加载 Carp::Always 以便您可以获得回溯并找出到底发生了什么。
Somewhere, you or someone else is passing a string to a function that expects an object. Your best first step in debugging would be to load Carp::Always so that you can get a backtrace and find out what's really happening.