[Catalyst] Howto use ConfigLoader?

Jonathan Rockway jon at jrock.us
Sat May 12 20:55:42 GMT 2007


On Saturday 12 May 2007 11:09:26 am John Romkey wrote:
> You'll see that message even if there's an error in the config file.
> YAML is very sensitive about whitespace. Try running the file through
> ysh, the YAML shell, to check for errors.

This is a waste of time.  I recommend adding a test to your test suite that 
validates the YAML with Test::YAML::Valid:

   #!/usr/bin/env perl
   use strict;
   use warnings;
   use Test::More tests => 2;
   use Test::YAML::Valid;

   my $CONFIG = 'myapp.yml';

   ok(-e $CONFIG, "$CONFIG exists");
   yaml_file_ok($CONFIG ,"$CONFIG validates");

Now you never have to worry about invalid YAML again.  (You might /have/ it, 
but you won't have to /worry/ about it ;)

Regards,
Jonathan Rockway

-- 
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: not available
Url : http://lists.scsys.co.uk/pipermail/catalyst/attachments/20070512/eb6a9918/attachment.pgp


More information about the Catalyst mailing list