[Catalyst] Howto use ConfigLoader?

Jeff Chimene jchimene at gmail.com
Sat May 12 15:56:10 GMT 2007


Johannes Rumpf wrote:
> Hey Geeks,
>
> i'm starting actually with catalyst and try to use the ConfigLoader.
> Actually i'm to dump to get something loaded or accessed. Maybe
> someone arround can give me a helping hand.
>
> Thats what i've done:
>
> package myapp;
> use Catalyst qw/-Debug ConfigLoader /;
>
> and put in the base-dir the following file, more or less exact as in
> the Catalyst tutorial.
It goes in "base-dir" You can place it elsewhere, but "elsewhere" isn't
the default. Stick with the default for now.
> myapp.yml
>
> Basicaly while starting catalyst quoting
>
> debug] Loaded plugins:
> .----------------------------------------------------------------------------.
>
> | Catalyst::Plugin::ConfigLoader  0.14      |
> '----------------------------------------------------------------------------'
>
>
> But no file afterwards.
>
> I'm a bit stucked in the middle.
>
> Where to put that file
> /
> /lib
> /src ??
It goes in "base-dir" Stick with the default for now.
>
> Howto find out if my Config is loaded? Because $c->config->{my_test}
> result in empty value?
Looks like good perl syntax. Have you checked the YAML file for syntax
errors? YAML is /very picky/ about whitespace. The YAML shell (ysh) is a
good debugging aid. e.g.:

$ cat aic.yml
---
name: aic
static:
  no_logs: 0
imgdir: /root/images

$ ysh < aic.yml
$VAR1 = {
  'imgdir' => '/root/images',
  'name' => 'aic',
  'static' => {
    'no_logs' => '0'
  }
};

[EDIT AIC.YML]

$ cat aic.yml
---
name: aic
 static:
  no_logs: 0
imgdir: /root/images

$ ysh < aic.yml
YAML Error: Inconsistent indentation level
   Code: YAML_PARSE_ERR_INCONSISTENT_INDENTATION
   Line: 3
   Document: 1
 at /usr/local/share/perl/5.8.8/YAML.pm line 33

Also, some kind soul has provided yml-mode for Emacs.
> Any advice?
>
> Thanks and cheers,
>  Johannes



More information about the Catalyst mailing list