FAQ
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

Search Discussions

  • Devin Austin at Jun 17, 2009 at 9:57 am
    What's the error you're getting?
    On Wed, Jun 17, 2009 at 3:52 AM, Ben Vinnerd 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@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@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!
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090617/93ad2fa8/attachment.htm
  • Ben Vinnerd at Jun 17, 2009 at 10:13 am

    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

    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090617/8c6afb41/attachment.htm
  • Devin Austin at Jun 17, 2009 at 10:15 am
    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 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@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive:
    http://www.mail-archive.com/catalyst@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!
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090617/4e7a1db6/attachment.htm
  • Ben Vinnerd at Jun 17, 2009 at 10:21 am

    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>
  • Joel Bernstein at Jun 17, 2009 at 10:02 am

    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
  • Ben Vinnerd at Jun 17, 2009 at 10:16 am

    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.
  • Tomas Doran at Jun 18, 2009 at 7:57 am

    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
  • Ben Vinnerd at Jun 18, 2009 at 2:26 pm

    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedJun 17, '09 at 9:52a
activeJun 18, '09 at 2:26p
posts9
users4
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase