Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Template rendering error under mod_perl

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


ra.jones at dpw

Jun 29, 2007, 2:47 AM

Post #1 of 12 (4356 views)
Permalink
Template rendering error under mod_perl

Having developed my application sufficiently to see it working well so
far, I though I should configure it to run under mod_perl. I have used
the TTSite helper to generate the templates. The app runs fine using
myapp_server.pl, but under mod_perl I get the following:

Couldn't render template "file error - login.tt2: not found"

I have a conventional setup (I think) with MyApp::View::TT config:
__PACKAGE__->config({
INCLUDE_PATH => [
MyApp->path_to( 'root', 'src' ),
MyApp->path_to( 'root', 'lib' )
],
# etc
});

The Apache mod_perl startup params include /path/to/MyApp/lib

Replacing INCLUDE_PATH with full pathnames ie /full/path/to/root/src and
/full/path/to/root/lib doesn't help, perhaps suggesting MyApp::View::TT
is not being found?

Catalyst::Helper::View::TTSite docs state that 'The view module that the
helper creates is automatically configured to locate these templates.'
Is there anything I have forgoten to do to port the application to
mod_perl that would explain this error?

--
Richard Jones


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


kiki at bsdro

Jun 29, 2007, 3:22 AM

Post #2 of 12 (4260 views)
Permalink
Re: Template rendering error under mod_perl [In reply to]

Richard Jones wrote:
> Having developed my application sufficiently to see it working well so
> far, I though I should configure it to run under mod_perl. I have used
> the TTSite helper to generate the templates. The app runs fine using
> myapp_server.pl, but under mod_perl I get the following:
>
> Couldn't render template "file error - login.tt2: not found"
>
Could be a permission issue, has the user the webserver runs under
access to that path / those files?


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


ra.jones at dpw

Jun 29, 2007, 3:49 AM

Post #3 of 12 (4257 views)
Permalink
Re: Template rendering error under mod_perl [In reply to]

Kiki wrote:
> Richard Jones wrote:
>
>> Having developed my application sufficiently to see it working well so
>> far, I though I should configure it to run under mod_perl. I have used
>> the TTSite helper to generate the templates. The app runs fine using
>> myapp_server.pl, but under mod_perl I get the following:
>>
>> Couldn't render template "file error - login.tt2: not found"
>>
>>
> Could be a permission issue, has the user the webserver runs under
> access to that path / those files?
>
>
> _______________________________________________
>
The user/group permissions on root/src and root/lib and the files
therein are the same as for lib/MyApp.pm, so presumably that isn't the
issue? There is nothing obvious in the error_log, though Apache doesn't
seem to log file permission errors even under debug mode.

--
Richard Jones


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


email at jasonkohles

Jun 29, 2007, 5:50 AM

Post #4 of 12 (4241 views)
Permalink
Re: Template rendering error under mod_perl [In reply to]

On Jun 29, 2007, at 5:47 AM, Richard Jones wrote:

> Having developed my application sufficiently to see it working well
> so far, I though I should configure it to run under mod_perl. I
> have used the TTSite helper to generate the templates. The app runs
> fine using myapp_server.pl, but under mod_perl I get the following:
>
Depending on how you installed it under mod_perl, you may find that
you need to set 'home' in your configuration for path_to to work, if
you don't explicitly set the path to the home directory, Catalyst
will try to figure it out by looking for your Makefile.PL/Build.PL or
by figuring out where the libraries are installed, but that may not
be the correct location for your root directory. Take a look at
Catalyst::Utils for the home method to see how it figures it out...

--
Jason Kohles
email [at] jasonkohles
http://www.jasonkohles.com/
"A witty saying proves nothing." -- Voltaire



_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


ra.jones at dpw

Jun 29, 2007, 6:20 AM

Post #5 of 12 (4269 views)
Permalink
Re: Template rendering error under mod_perl [In reply to]

Jason Kohles wrote:
> On Jun 29, 2007, at 5:47 AM, Richard Jones wrote:
>
>> Having developed my application sufficiently to see it working well
>> so far, I though I should configure it to run under mod_perl. I have
>> used the TTSite helper to generate the templates. The app runs fine
>> using myapp_server.pl, but under mod_perl I get the following:
>>
> Depending on how you installed it under mod_perl, you may find that
> you need to set 'home' in your configuration for path_to to work, if
> you don't explicitly set the path to the home directory, Catalyst will
> try to figure it out by looking for your Makefile.PL/Build.PL or by
> figuring out where the libraries are installed, but that may not be
> the correct location for your root directory. Take a look at
> Catalyst::Utils for the home method to see how it figures it out...
>
I didn't actually 'install' it as such, just copied the MyApp directory
under my /home folder, added the path/to/MyApp/lib to mod_perl's lib in
startup.pl file so it can find MyApp.pm, and re-started the server. It
looks like Catalyst _can_ find the 'home' directory, as it displays
correctly in the rather verbose 'Config' section of the screen dump:
home => '/home/raj/www/apps/MyApp',
and directly under that is root/lib and root/src. I REALLY need to fix
this one or I'm sunk!

--
Richard Jones


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


moseley at hank

Jun 29, 2007, 6:52 AM

Post #6 of 12 (4254 views)
Permalink
Re: Template rendering error under mod_perl [In reply to]

On Fri, Jun 29, 2007 at 02:20:23PM +0100, Richard Jones wrote:
> I didn't actually 'install' it as such, just copied the MyApp directory
> under my /home folder, added the path/to/MyApp/lib to mod_perl's lib in
> startup.pl file so it can find MyApp.pm, and re-started the server. It
> looks like Catalyst _can_ find the 'home' directory, as it displays
> correctly in the rather verbose 'Config' section of the screen dump:
> home => '/home/raj/www/apps/MyApp',
> and directly under that is root/lib and root/src. I REALLY need to fix
> this one or I'm sunk!

What debugging did you do? Did you dump the INCLUDE_PATH?
Template::Provider also has some dubbing available. Did you enable
that? Have you tried making a local copy of Template::Provider in
your lib directory and throw in some warn statements?

--
Bill Moseley
moseley [at] hank


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


ra.jones at dpw

Jun 29, 2007, 8:33 AM

Post #7 of 12 (4235 views)
Permalink
Re: Template rendering error under mod_perl [In reply to]

Bill Moseley wrote:
> On Fri, Jun 29, 2007 at 02:20:23PM +0100, Richard Jones wrote:
>
>> I didn't actually 'install' it as such, just copied the MyApp directory
>> under my /home folder, added the path/to/MyApp/lib to mod_perl's lib in
>> startup.pl file so it can find MyApp.pm, and re-started the server. It
>> looks like Catalyst _can_ find the 'home' directory, as it displays
>> correctly in the rather verbose 'Config' section of the screen dump:
>> home => '/home/raj/www/apps/MyApp',
>> and directly under that is root/lib and root/src. I REALLY need to fix
>> this one or I'm sunk!
>>
>
> What debugging did you do? Did you dump the INCLUDE_PATH?
>
In MyApp::View::TT:
MyApp::Debug::DEBUG( __PACKAGE__->config->{INCLUDE_PATH} ):

$VAR1 = [.
bless( {
'file_spec_class' => undef,
'volume' => '',
'dirs' => [
'',
'home',
'raj',
'www',
'apps',
'MyApp',
'root',
'lib'
]
}, 'Path::Class::Dir' ),
bless( {
'file_spec_class' => undef,
'volume' => '',
'dirs' => [
'',
'home',
'raj',
'www',
'apps',
'MyApp',
'root',
'templates'
]
}, 'Path::Class::Dir' )
];

This is correct - I moved the templates dir underneath MyApp/root.
> Template::Provider also has some dubbing available. Did you enable
> that? Have you tried making a local copy of Template::Provider in
> your lib directory and throw in some warn statements?
>
>
No, I wasn't aware of it's existence! Even after reading the docs it's
not clear (to me) how to use the $provider object within Catalyst to get
the template path, or why this is any better than using the INCLUDE_PATH
from MyApp::View::TT

This is getting weirder - if I try to load a page normally available
only after login, I get another path error in addition to the template
error:
Form (search): Can't find form config search.fb in:
/home/raj/www/apps/MyApp/root/forms, yet search.fb is most definitely
present in /home/raj/www/apps/MyApp/root/forms. All root sub-dir files
set to 0644 permissions, with user/group set to same as other web files.
What gives?

--
Richard Jones


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


dbix-class at trout

Jun 29, 2007, 9:19 AM

Post #8 of 12 (4238 views)
Permalink
Re: Template rendering error under mod_perl [In reply to]

On Fri, Jun 29, 2007 at 11:49:33AM +0100, Richard Jones wrote:
> Kiki wrote:
> >Richard Jones wrote:
> >
> >>Having developed my application sufficiently to see it working well so
> >>far, I though I should configure it to run under mod_perl. I have used
> >>the TTSite helper to generate the templates. The app runs fine using
> >>myapp_server.pl, but under mod_perl I get the following:
> >>
> >>Couldn't render template "file error - login.tt2: not found"
> >>
> >>
> >Could be a permission issue, has the user the webserver runs under
> >access to that path / those files?
> >
> >
> >_______________________________________________
> >
> The user/group permissions on root/src and root/lib and the files
> therein are the same as for lib/MyApp.pm, so presumably that isn't the
> issue? There is nothing obvious in the error_log, though Apache doesn't
> seem to log file permission errors even under debug mode.

Apache may load code while still root.

su to the user it runs at and try to cd into the MyApp dir and cat a template
file.

--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director Want a managed development or deployment platform?
Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


ra.jones at dpw

Jun 29, 2007, 9:27 AM

Post #9 of 12 (4246 views)
Permalink
Re: Template rendering error under mod_perl [In reply to]

Richard Jones wrote:
> Kiki wrote:
>> Richard Jones wrote:
>>
>>> Having developed my application sufficiently to see it working well so
>>> far, I though I should configure it to run under mod_perl. I have used
>>> the TTSite helper to generate the templates. The app runs fine using
>>> myapp_server.pl, but under mod_perl I get the following:
>>>
>>> Couldn't render template "file error - login.tt2: not found"
>>>
>>>
>> Could be a permission issue, has the user the webserver runs under
>> access to that path / those files?
>>
>>
>> _______________________________________________
>>
> The user/group permissions on root/src and root/lib and the files
> therein are the same as for lib/MyApp.pm, so presumably that isn't the
> issue? There is nothing obvious in the error_log, though Apache
> doesn't seem to log file permission errors even under debug mode.
OK, contrary to my previous post, it clearly is a file permissions issue
(thanks KiKi), as chmod 777 * -R in MyApp fixed the problem at a stroke
(it's not on a public server!). Changing all directories to 755 and
files to 644 (or 666 if need to be writable) seems to retain functionality.

Could I have avoided this embarrassment by using Makefile.PL in the app
directory? OT I know, but what is the recommended permissions for files
and directories for web-apps run under Catalyst/mod_perl?

--
Richard Jones


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


dbix-class at trout

Jun 29, 2007, 10:30 AM

Post #10 of 12 (4241 views)
Permalink
Re: Template rendering error under mod_perl [In reply to]

On Fri, Jun 29, 2007 at 04:33:46PM +0100, Richard Jones wrote:
> This is getting weirder - if I try to load a page normally available
> only after login, I get another path error in addition to the template
> error:
> Form (search): Can't find form config search.fb in:
> /home/raj/www/apps/MyApp/root/forms, yet search.fb is most definitely
> present in /home/raj/www/apps/MyApp/root/forms. All root sub-dir files
> set to 0644 permissions, with user/group set to same as other web files.
> What gives?

The directory needs to be 755.

--
Matt S Trout Need help with your Catalyst or DBIx::Class project?
Technical Director Want a managed development or deployment platform?
Shadowcat Systems Ltd. Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/ http://www.shadowcatsystems.co.uk/

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


moseley at hank

Jun 29, 2007, 10:42 AM

Post #11 of 12 (4236 views)
Permalink
Re: Template rendering error under mod_perl [In reply to]

On Fri, Jun 29, 2007 at 04:33:46PM +0100, Richard Jones wrote:
> Form (search): Can't find form config search.fb in:
> /home/raj/www/apps/MyApp/root/forms, yet search.fb is most definitely
> present in /home/raj/www/apps/MyApp/root/forms. All root sub-dir files
> set to 0644 permissions, with user/group set to same as other web files.
> What gives?

Do you know about the secret -m option to perldoc? -m is what give
the real manual.

perldoc -m Template::Provider and page down until you something handy:

# _template_content($path)
#
# Fetches content pointed to by $path.

Then you can do:[1]

warn "Hey, TT is looking for [$path]\n";


which might give you a lead.


[1]

$ cat ~/bin/mvim
#!/bin/sh
sudo vim `perldoc -l "$1"`


--
Bill Moseley
moseley [at] hank


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


pagaltzis at gmx

Jun 29, 2007, 1:11 PM

Post #12 of 12 (4241 views)
Permalink
Re: Template rendering error under mod_perl [In reply to]

* Richard Jones <ra.jones [at] dpw> [2007-06-29 18:35]:
> OK, contrary to my previous post, it clearly is a file
> permissions issue (thanks KiKi), as chmod 777 * -R in MyApp
> fixed the problem at a stroke (it's not on a public server!).
> Changing all directories to 755 and files to 644 (or 666 if
> need to be writable) seems to retain functionality.

It should never be necessary to make a file or directory world-
writable. If you find yourself needing to, then you’ve done
something wrong with the account situation on the machine.

(I know you said this isn’t production; I wanted to reinforce
that this is a Bad Idea.)

Regards,
--
Aristotle Pagaltzis // <http://plasmasturm.org/>

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.