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

Mailing List Archive: Catalyst: Users

ConfigLoader trouble

 

 

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


ben-catalyst at vinnerd

Jun 17, 2009, 2:52 AM

Post #1 of 9 (689 views)
Permalink
ConfigLoader trouble

Hi all,

Have got a problem with ConfigLoader not reading %ENV.

At the top of Myapp.pm i have:

use parent qw/Catalyst/;
use Catalyst qw/StackTrace ConfigLoader/;

...and i'm setting env var in httpd.conf:

PerlSetVar MYAPP_CONFIG_LOCAL_SUFFIX beta

... but ConfigLoader will not load myapp_beta.conf from the application dir.

I have output the contents of %ENV to my Apache log, and
MYAPP_CONFIG_LOCAL_SUFFIX is there.

I'm stumped, as i have this working on another machine.

If i manually set ConfigLoader's file option, it loads the config fine:

__PACKAGE__->config->{'Plugin::ConfigLoader'} = {file =>
'/home/ben/Myapp/myapp_beta.conf'};

Any ideas?

Ben


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


devin.austin at gmail

Jun 17, 2009, 2:57 AM

Post #2 of 9 (643 views)
Permalink
Re: ConfigLoader trouble [In reply to]

What's the error you're getting?

On Wed, Jun 17, 2009 at 3:52 AM, Ben Vinnerd <ben-catalyst[at]vinnerd.com>wrote:

> Hi all,
>
> Have got a problem with ConfigLoader not reading %ENV.
>
> At the top of Myapp.pm i have:
>
> use parent qw/Catalyst/;
> use Catalyst qw/StackTrace ConfigLoader/;
>
> ...and i'm setting env var in httpd.conf:
>
> PerlSetVar MYAPP_CONFIG_LOCAL_SUFFIX beta
>
> ... but ConfigLoader will not load myapp_beta.conf from the application
> dir.
>
> I have output the contents of %ENV to my Apache log, and
> MYAPP_CONFIG_LOCAL_SUFFIX is there.
>
> I'm stumped, as i have this working on another machine.
>
> If i manually set ConfigLoader's file option, it loads the config fine:
>
> __PACKAGE__->config->{'Plugin::ConfigLoader'} = {file =>
> '/home/ben/Myapp/myapp_beta.conf'};
>
> Any ideas?
>
> Ben
>
>
> _______________________________________________
> List: Catalyst[at]lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>



--
Devin Austin
http://www.codedright.net
http://www.dreamhost.com/r.cgi?326568/hosting.html - Host with DreamHost!


joel at fysh

Jun 17, 2009, 3:02 AM

Post #3 of 9 (648 views)
Permalink
Re: ConfigLoader trouble [In reply to]

On 17 Jun 2009, at 10:52, Ben Vinnerd wrote:
> Have got a problem with ConfigLoader not reading %ENV.
>
> At the top of Myapp.pm i have:
> use parent qw/Catalyst/;
> use Catalyst qw/StackTrace ConfigLoader/;
> ...and i'm setting env var in httpd.conf:
> PerlSetVar MYAPP_CONFIG_LOCAL_SUFFIX beta
^^^ is this intentional? Should be Env?
>
> ... but ConfigLoader will not load myapp_beta.conf from the
> application dir.
>
> I have output the contents of %ENV to my Apache log, and
> MYAPP_CONFIG_LOCAL_SUFFIX is there.
>
> I'm stumped, as i have this working on another machine.
>
> If i manually set ConfigLoader's file option, it loads the config
> fine:
>
> __PACKAGE__->config->{'Plugin::ConfigLoader'} = {file => '/home/ben/
> Myapp/myapp_beta.conf'};
>
> Any ideas?

I've not run Catalyst under mod_perl in quite a while, but I would
expect PerlSetEnv to definitely DTRT. Are PerlSetVar variables made
available in %ENV under C::Engine::Apache? I don't believe so. Does
switching to PerlSetEnv fix your issue?

/joel



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


ben-catalyst at vinnerd

Jun 17, 2009, 3:13 AM

Post #4 of 9 (645 views)
Permalink
Re: ConfigLoader trouble [In reply to]

On 17/06/09 10:57, Devin Austin wrote:
> What's the error you're getting?
>

The <Model::DB> config i'm putting in myapp_beta.conf isn't being read
by ConfigLoader, so the error i'm getting is from DBIx::Class stating
that it needs connect_info. But this error is irrelevant... it's
ConfigLoader not reading the file that is the problem.

Ben


devin.austin at gmail

Jun 17, 2009, 3:15 AM

Post #5 of 9 (647 views)
Permalink
Re: ConfigLoader trouble [In reply to]

Paste your conf, connect_info actually has to be an array(ref?) and it has
to be put together kinda funny in myapp.conf.

On Wed, Jun 17, 2009 at 4:13 AM, Ben Vinnerd <ben-catalyst[at]vinnerd.com>wrote:

> On 17/06/09 10:57, Devin Austin wrote:
>
> What's the error you're getting?
>
>
> The <Model::DB> config i'm putting in myapp_beta.conf isn't being read by
> ConfigLoader, so the error i'm getting is from DBIx::Class stating that it
> needs connect_info. But this error is irrelevant... it's ConfigLoader not
> reading the file that is the problem.
>
> Ben
>
>
> _______________________________________________
> List: Catalyst[at]lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>


--
Devin Austin
http://www.codedright.net
http://www.dreamhost.com/r.cgi?326568/hosting.html - Host with DreamHost!


ben-catalyst at vinnerd

Jun 17, 2009, 3:16 AM

Post #6 of 9 (645 views)
Permalink
Re: ConfigLoader trouble [In reply to]

On 17/06/09 11:02, Joel Bernstein wrote:
> On 17 Jun 2009, at 10:52, Ben Vinnerd wrote:
>> Have got a problem with ConfigLoader not reading %ENV.
>>
>> At the top of Myapp.pm i have:
>> use parent qw/Catalyst/;
>> use Catalyst qw/StackTrace ConfigLoader/;
>> ...and i'm setting env var in httpd.conf:
>> PerlSetVar MYAPP_CONFIG_LOCAL_SUFFIX beta
> ^^^ is this intentional? Should be Env?
>>
>> ... but ConfigLoader will not load myapp_beta.conf from the
>> application dir.
>>
>> I have output the contents of %ENV to my Apache log, and
>> MYAPP_CONFIG_LOCAL_SUFFIX is there.
>>
>> I'm stumped, as i have this working on another machine.
>>
>> If i manually set ConfigLoader's file option, it loads the config fine:
>>
>> __PACKAGE__->config->{'Plugin::ConfigLoader'} = {file =>
>> '/home/ben/Myapp/myapp_beta.conf'};
>>
>> Any ideas?
>
> I've not run Catalyst under mod_perl in quite a while, but I would
> expect PerlSetEnv to definitely DTRT. Are PerlSetVar variables made
> available in %ENV under C::Engine::Apache? I don't believe so. Does
> switching to PerlSetEnv fix your issue?
>
Sorry, typo, yes i'm using PerlSetEnv, *not* PerlSetVar.

I have "PerlOptions +SetupEnv" in my apache config, and like i say i
output %ENV and it's definately there.

It's like ConfigLoader's setup() isn't being run, or it's choosing to
ignore the MYAPP_CONFIG_LOCAL_SUFFIX i'm setting.


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


ben-catalyst at vinnerd

Jun 17, 2009, 3:21 AM

Post #7 of 9 (648 views)
Permalink
Re: ConfigLoader trouble [In reply to]

On 17/06/09 11:15, Devin Austin wrote:
> Paste your conf, connect_info actually has to be an array(ref?) and it
> has to be put together kinda funny in myapp.conf.
>

<Model::DB>
connect_info dbi:mysql:motoring:localhost;mysql_client_found_rows=1
connect_info xxxxxxxxxxxx
connect_info xxxxxxxxxxxx

<connect_info>
AutoCommit 0
PrintError 1
RaiseError 1
</connect_info>

<connect_info>
on_connect_do "set names utf8"
</connect_info>
</Model::DB>


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


bobtfish at bobtfish

Jun 18, 2009, 12:57 AM

Post #8 of 9 (617 views)
Permalink
Re: ConfigLoader trouble [In reply to]

On 17 Jun 2009, at 11:16, Ben Vinnerd wrote:
>
> It's like ConfigLoader's setup() isn't being run, or it's choosing
> to ignore the MYAPP_CONFIG_LOCAL_SUFFIX i'm setting.
>

I'm afraid the best way to debug this is likely to be brute force.

Copy your apache config somewhere, mangle it to only run 1 child
process, then try to start the app with strace -f, pipe the stdout
and stderr to a file.

You can then grep through that file for instances of myapp_.*\.(conf|
yml|whatever).

This should help you build a mental model of how it's going wrong
(e.g. looking for the wrong filename, looking in the wrong place,
just not looking etc).

One you know what it's doing wrong in more detail then it'll be
easier to work out how to debug/fix.

Cheers
t0m


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


ben-catalyst at vinnerd

Jun 18, 2009, 7:26 AM

Post #9 of 9 (615 views)
Permalink
Re: ConfigLoader trouble [In reply to]

On 18/06/09 08:57, Tomas Doran wrote:
>
> On 17 Jun 2009, at 11:16, Ben Vinnerd wrote:
>>
>> It's like ConfigLoader's setup() isn't being run, or it's choosing to
>> ignore the MYAPP_CONFIG_LOCAL_SUFFIX i'm setting.
>>
>
> I'm afraid the best way to debug this is likely to be brute force.
>
No need - i tried putting back the Makefile.PL i deleted (as per other
thread), and ConfigLoader (as if by magic) started working again.

I really should read important notices a bit more :)

Ben


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

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


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.