2

我正在尝试让Catalyst框架使用Template Toolkit,但我遇到了问题Template::Provider。我已将问题隔离到调用stat. 在Template::Provider::_init中,调用stat正常工作,但在其他函数中调用 stat 返回 []。似乎Template::Provider正在做一些奇怪的缓存工作,但我不太清楚是什么。有人有想法么?

编辑:更详细一点:

我正在尝试从 Catalyst 开发服务器迁移到 Apache/mod_perl。我得到一个Couldn't render template "file error - mytemplate.tt: not found"错误。这是我的配置的调试转储:

Config
do {
  my $a = {
    "Action::RenderView" => {
          ignore_classes => [
                              "DBIx::Class::ResultSource::Table",
                              "DBIx::Class::ResultSourceHandle",
                              "DateTime",
                            ],
          scrubber_func  => sub { "???" },
        },
    "Plugin::ConfigLoader" => {},
    home => "/home/myuser/pathtosite",
    name => "Stream",
    root => bless({
          dirs => ["", "home", "myuser", "pathtosite"],
          file_spec_class => undef,
          volume => "",
        }, "Path::Class::Dir"),
    static => {
          debug => 1,
          dirs => [],
          ignore_dirs => [],
          ignore_extensions => ["tmpl", "tt", "tt2", "html", "xhtml"],
          include_path => ['fix'],
          mime_types => {},
          mime_types_obj => bless({}, "MIME::Types"),
          no_logs => 1,
        },
  };
  $a->{static}{include_path}[0] = $a->{root};
  $a;
}

几乎与某人在这里描述的完全相同的问题:http ://www.gossamer-threads.com/lists/catalyst/users/14888

4

1 回答 1

4

假设您的文件实际上位于/home/myuser/pathtosite目录中(而不是子目录),这似乎是 Catalyst 进程无法读取那里的文件的问题。如果您在 SELinux 环境中运行,它也可能与安全上下文有关(例如,安全上下文类型httpd_sys_content_t)。

在尝试渲染模板之前,您能否进行一些调试以确保文件从 Catalyst 进程中首先可见?

于 2009-09-13T12:10:19.917 回答