【问题标题】:Apache2::Const qw() equivalent for Apache::Constants qw(:common :response)Apache2::Const qw() 等效于 Apache::Constants qw(:common :response)
【发布时间】:2012-09-23 14:26:42
【问题描述】:

我仍在努力尝试将遗留的 perl 应用程序从 Apache 1.3.x(以及谁真正知道 perl 的版本)移植到 RHEL6 ......这是 Apache 2.2.x / perl 5.10 .x

无论如何,如果有人知道等价于

use Apache::Constants qw(:common :response);

... 需要重构以使用 Apache2 ...

use Apache2::Const qw(:common :response);  <--This is _not_ correct.

看起来有 :common,但是 :response 抛出错误:“unknown apache2_const:: group `response'”

另外,如果有人能在这里“教人钓鱼”,将不胜感激。

【问题讨论】:

    标签: perl apache apache2 porting


    【解决方案1】:

    如果您不导入任何内容并使用use strict;,如果您使用未导入的常量,您几乎肯定会遇到编译错误。所以可以使用

    use Apache2::Const qw( );
    

    然后将您实际需要的内容添加到导入列表中,这通过查看编译时错误消息来确定。

    【讨论】:

    • 谢谢。如果没有别的,让编译器告诉你它需要它。
    【解决方案2】:

    根据文档,使用标签 :common 导入将带来以下内容:

    Apache2::Const::AUTH_REQUIRED
    Apache2::Const::DECLINED
    Apache2::Const::DONE
    Apache2::Const::FORBIDDEN
    Apache2::Const::NOT_FOUND
    Apache2::Const::OK
    Apache2::Const::REDIRECT
    Apache2::Const::SERVER_ERROR
    

    您知道在导入:response 时您愿意使用哪些标签吗?如果是这样,请尝试寻找他们here

    【讨论】:

    猜你喜欢
    • 2011-04-01
    • 2012-02-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-24
    • 2011-06-28
    • 2013-01-13
    • 1970-01-01
    相关资源
    最近更新 更多