views:

238

answers:

1

I am trying to get the Catalyst framework to work using Template Toolkit, and I'm having issues with Template::Provider. I've isolated the issue to calls to stat. In Template::Provider::_init, calls to stat work correctly, however in other functions calls to stat return []. It seems like Template::Provider is doing some weird caching stuff, but I can't quite figure out what. Anyone have any ideas?

EDIT: A bit more detail:

I'm trying to move from the Catalyst development server to Apache/mod_perl. I get a Couldn't render template "file error - mytemplate.tt: not found" error. Here is the debug dump of my config:

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;
}

Pretty much the exact same issue that someone described here: http://www.gossamer-threads.com/lists/catalyst/users/14888

+1  A: 

Assuming your files are actually in the /home/myuser/pathtosite directory (and not a subdirectory), this seems like it could be a perimssion problem with the Catalyst process not being able to read the files there. If you're running in an SELinux environment, it could also have to do with the security context (e.g., security context type httpd_sys_content_t).

Can you do some debugging to ensure that the files are visible from the Catalyst process in the first place, before it attempts to render the template?

Adam Bellaire
Almost bound to be this, in fact - if you're using a system Apache process on Linux, rather than one run by your user, it'll probably be running as www_user and have no access to your files. I find developing with a self-run process works better, but you'll need to configure it to a high port (1024+) because only root has access to low ports.
ijw
Sam Lee