如何使用mod_perl使CGI :: Application :: Dispatch工作?

时间:2022-10-05 17:37:38

Ok, so I am trying to set up a Dispatcher with mod_perl and I don't really know what I am doing wrong. I am fairly positive that the issue is with my mod_perl configuration. Here is what I think is relevant:

好吧,所以我试图用mod_perl设置一个Dispatcher,我真的不知道我做错了什么。我相当肯定,问题在于我的mod_perl配置。以下是我认为相关的内容:

Apache Directory Config

Apache Directory Config

<Directory  "C:/Documents and Settings/frew/My Documents/acd">
   SetHandler perl-script
   PerlHandler ACD::Dispatch
    Options Indexes FollowSymLinks ExecCGI
    AllowOverride None
    Order allow,deny
    Allow from all
    DirectoryIndex Default.html
</Directory>

Note: ACD::Dispatch is in acd/ACD.

注意:ACD :: Dispatch是acd / ACD。

ACD::Dispatch

package ACD::Dispatch;
use base 'CGI::Application::Dispatch';
sub dispatch_args {
    return {
        prefix  => 'ACD',
        table   => [
        ''                => { app => 'Controller', rm => 'awesome' },
        ':app/:rm'        => { },
        ],
    };
}

And probably most importantly, the Apache errors:

也许最重要的是,Apache错误:

[Mon Jan 12 17:42:08 2009] [error] [client 10.6.1.73] failed to resolve handler `ACD::Dispatch': Can't locate ACD/Dispatch.pm in @INC (@INC contains: C:/usr/site/lib C:/usr/lib . C:/Program Files/Apache Software Foundation/Apache2.2) at (eval 3) line 3.\n

Thanks for any help!

谢谢你的帮助!

Update: I needed to add this to my Apache config:

更新:我需要将其添加到我的Apache配置中:

<Perl>
   use lib '/path/to/acd';
</Perl>

1 个解决方案

#1


Well, based on the error message:

好吧,根据错误信息:

ACD::Dispatch: Can't locate ACD/Dispatch.pm in @INC (@INC contains: C:/usr/site/lib C:/usr/lib . C:/Program Files/Apache Software Foundation/Apache2.2

ACD :: Dispatch:无法在@INC中找到ACD / Dispatch.pm(@INC包含:C:/ usr / site / lib C:/ usr / lib.C:/ Program Files / Apache Software Foundation / Apache2.2

and the fact that you said:

你说的事实是:

ACD::Dispatch is in acd/ACD.

ACD :: Dispatch是acd / ACD。

It looks like you need to put the "acd" directory in the @INC path, using its absolute pathname.

看起来您需要使用其绝对路径名将“acd”目录放在@INC路径中。

Although you might think '.' is on @INC and that should be your acd directory, I don't that that it is, under mod_perl. See, for example, this discussion.

虽然你可能会想'。'是在@INC上,应该是你的acd目录,我不是那个,在mod_perl下。例如,参见本讨论。

#1


Well, based on the error message:

好吧,根据错误信息:

ACD::Dispatch: Can't locate ACD/Dispatch.pm in @INC (@INC contains: C:/usr/site/lib C:/usr/lib . C:/Program Files/Apache Software Foundation/Apache2.2

ACD :: Dispatch:无法在@INC中找到ACD / Dispatch.pm(@INC包含:C:/ usr / site / lib C:/ usr / lib.C:/ Program Files / Apache Software Foundation / Apache2.2

and the fact that you said:

你说的事实是:

ACD::Dispatch is in acd/ACD.

ACD :: Dispatch是acd / ACD。

It looks like you need to put the "acd" directory in the @INC path, using its absolute pathname.

看起来您需要使用其绝对路径名将“acd”目录放在@INC路径中。

Although you might think '.' is on @INC and that should be your acd directory, I don't that that it is, under mod_perl. See, for example, this discussion.

虽然你可能会想'。'是在@INC上,应该是你的acd目录,我不是那个,在mod_perl下。例如,参见本讨论。