Ok. Sorry to hear about your back :(, hope you feel better.

I was thinking about making this change, which changes the default data dir to 
always be alongside the comp root. If you are able, can you apply this change 
to your version and see if it makes the default better under apache? (For some 
reason I'm not able to reproduce your bug on my system).

Also, clearly, I need to improve the error message when the object dir is not 
writable.

Thanks
Jon

--- a/lib/Dancer/Template/Mason2.pm
+++ b/lib/Dancer/Template/Mason2.pm
@@ -1,5 +1,6 @@
 package Dancer::Template::Mason2;
 use Dancer::Config 'setting';
+use File::Basename;
 use FindBin;
 use Mason;
 use strict;
@@ -14,7 +15,7 @@ sub init {
     my $config = $self->config || {};
 
     $root_dir = $config->{comp_root} ||= setting('views') || $FindBin::Bin . 
'/views';
-    $config->{data_dir} ||= $FindBin::Bin . "/data";
+    $config->{data_dir} ||= dirname($root_dir) . "/data";
     $config->{autoextend_request_path} = 0 if !exists( 
$config->{autoextend_request_path} );
 
     $_engine = Mason->new(%$config);


On Aug 1, 2011, at 1:35 AM, Stephen Fenwick-Paul wrote:

> Thanks for the reply. Sorry for the delay. I've done my back in and typing on 
> my laptop upside down is one of the skills they don't teach at college.
> 
> But my small investigation points towards the default value of data_dir being 
> the issue. When running Dancer in standalone mode data_dir correctly points 
> to 'data' in the application's root. But when running under apache it appears 
> to    want 'data' to be in /usr/sbin - where, on Ubuntu, apache2 resides.
> 
> So setting data_dir to something sensible fixes my problem. 
> 
> 
> 
> On Mon, Jul 25, 2011 at 11:39 PM, Jonathan Swartz <swa...@pobox.com> wrote:
> It worked for me. I'm able to see the "Running with Mason" via Apache.
> 
> It would be great to get the stacktrace where that "not memoized" error is 
> happening. Maybe you can load Devel::SimpleTrace or Carp::Always in the 
> apache process?
> 
> On Jul 22, 2011, at 3:40 AM, Stephen Fenwick-Paul wrote:
> 
>> Hi all
>> 
>> I'm getting a "CODE(0x7fe2bc5dfba8) not memoized at 
>> /usr/share/perl/5.10/Memoize.pm line 204." when using Mason2 with 
>> PerlDancer, but only when  running under Apache.
>> 
>> 
>> How to reproduce (install  Dancer & Dancer::Template::Mason2 first):
>> 
>> 
>> Make a simple dancer app:
>> 
>> $ dancer Simple
>> 
>> Start it:
>> 
>> $ Simple/bin/app.pl
>> 
>> And view http://localhost:3000
>> 
>> And you will see a default page. Good.
>> 
>> Copy views/index.tt to views/index.mc
>> Copy views/layout/main.tt to views/layout/main.mc 
>> 
>> and convert them to Mason2 or just simple HTML pages
>> 
>> index,mc:
>> <p>Running with Mason</p> 
>> 
>> main.mc:
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
>> <html xmlns="http://www.w3.org/1999/xhtml";>
>> <head>
>> <meta http-equiv="Content-type" content="text/html; charset=<% 
>> $.settings->{charset} %>" />
>> <title>Simple</title>
>> <link rel="stylesheet" href="<% $.request->{uri_base} %>/css/style.css" />
>> 
>> </head>
>> <body>
>>  <% $.content %>
>> </body>
>> </html>
>> 
>> <%args>
>> $.content
>> $.request
>> $.settings
>> </%args>
>> 
>> And in config.yml
>> 
>> replace:
>>   template: "simple" 
>> with
>>   template: "mason2"
>> 
>> Restart dancer:
>> 
>> bin/app.pl
>> 
>> and all is good.
>> 
>> Now do it under Apache:
>> 
>> Create a httpd.conf: 
>> 
>>     PerlModule Dancer::Template::Mason2;
>> 
>>     <VirtualHost *:80>
>>      
>>         ServerName www.simple.new
>>         ServerAlias simple.new
>>         DocumentRoot /home/yours/DancerTest/Simple
>> 
>>         <Directory  /home/yours/DancerTest/Simple>
>>             AllowOverride None
>>             Order allow,deny
>>             Allow from all
>>         </Directory>
>> 
>>         <Location />
>>             SetHandler perl-script
>>             PerlHandler Plack::Handler::Apache2
>>             PerlSetVar psgi_app /home/yours/DancerTest/Simple/bin/app.pl
>>         </Location>
>> 
>>         ErrorLog  /var/log/apache2/simple_error_log
>>         CustomLog /var/log/apache2/simple_access_log common
>>     </VirtualHost>
>> 
>> (This is taken from Dancers Deployment guide)
>> 
>> Start apache & go to http://www.simple.new and you will get the runtime 
>> error.
>> 
>> I've got latest versions of Dancer, Mason2 & Dancer::Template::Mason2;
>> 
>> ta for any insights
>> 
>> 
>> Stephen
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> ------------------------------------------------------------------------------
>> 10 Tips for Better Web Security
>> Learn 10 ways to better secure your business today. Topics covered include:
>> Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
>> security Microsoft Exchange, secure Instant Messaging, and much more.
>> http://www.accelacomm.com/jaw/sfnl/114/51426210/_______________________________________________
>> Mason-users mailing list
>> Mason-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/mason-users
> 
> 
> ------------------------------------------------------------------------------
> Got Input?   Slashdot Needs You.
> Take our quick survey online.  Come on, we don't ask for help often.
> Plus, you'll get a chance to win $100 to spend on ThinkGeek.
> http://p.sf.net/sfu/slashdot-survey
> _______________________________________________
> Mason-users mailing list
> Mason-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mason-users

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Mason-users mailing list
Mason-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mason-users

Reply via email to