[Catalyst] Hair-pulling over YAML config

Carl Vincent C.A.Vincent at newcastle.ac.uk
Mon Jan 29 16:19:49 GMT 2007


Hi everyone,

I've just spent an inordinate amount of time debugging a problem which
was actually caused by my Yaml config file not parsing properly.
Catalyst isn't helping much - all it does is skip out the line of debug
that says "[debug] Loaded Config ..." and that's easy to overlook.

I discovered that when the file is loaded in Config::Any, if there's an
error with the parsing it just skips it and doesn't bother to alert
anyone.

Is there a smart way to test for your config file failing to parse? 

I've patched my Config::Any (attached below) so it throws a warning. Not
sure if this would cause problems if it was included in the distributed
module...

Cheers

Carl

-- 
     -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
     Carl Vincent             http://www.netskills.ac.uk/ (URL)
     Systems Manager                       0191 222 5003 (voice)
     Netskills, Newcastle University       0191 222 5001  (fax)
     Training  -  Accreditation  -  Consultancy  -  Development


*** /opt/sandbox/lib/perl5/site_perl/5.8.8/Config/Any.pm
2006-08-22 22:35:28.000000000 +0100
--- lib/Config/Any.pm   2007-01-29 14:06:33.000000000 +0000
***************
*** 160,166 ****
                        eval {
                                $config = $loader->load( $filename );
                        };
!                       next if $EVAL_ERROR;
              next if !$config;
                        delete $files{$filename};
  #                     warn "loader $loader loaded file $filename\n";
--- 160,170 ----
                        eval {
                                $config = $loader->load( $filename );
                        };
!       if ($EVAL_ERROR) {
!               warn( "$EVAL_ERROR\n" );
!         next;
!       }
! #                     next if $EVAL_ERROR;
              next if !$config;
                        delete $files{$filename};
  #                     warn "loader $loader loaded file $filename\n";



More information about the Catalyst mailing list