1

我想使用我的应用程序的配置文件配置我的控制器中的所有操作。根据Catalyst::Controller我可以在控制器本身中执行此操作:

__PACKAGE__->config(
    action => {
        '*' => { Chained => 'base', Args => 0  },
    },
 );

所以我在我的配置中尝试了这个:

<controller Foo>
    <action "*">                                                                
        Chained base
        Args 0
    </action>
</controller>

但我在启动时收到此错误:

Couldn't load class (MyApp) because: Action "*" is not available from 
controller MyApp::Controller::Foo at /usr/local/share/perl/5.10.1/Catalyst/
Controller.pm line 193

没有星号周围的引号也是如此。我该怎么做?

4

1 回答 1

3

这在《催化剂权威指南》中有介绍

从该页面获取可下载的源,解压缩,转到第 7 章中的 DwarfChains 应用程序,然后将以下内容添加到 dwarfchains.conf:

 <Controller People>
 <action get_ready>
  PathPart nama
 </action>
 </Controller>

 <Controller People::Info>
 <action get_info_ready>
  PathPart siapa
 </action >
 <action create>
  PathPart lagi
 </action >
 <action delete>
  PathPart mengusir
 </action >
 </Controller>

这应该或多或少地演示如何通过配置覆盖调度。

于 2010-10-25T23:03:57.140 回答