Solved... (it was an invisible character, but see below) -- On Nov 14, 2011, at 6:13 AM, David Precious wrote:
On Monday 14 November 2011 03:09:01 Puneet Kishor wrote:
This is bizarre.
<snipped fine-looking config>
The above config file works just fine on my laptop, but fails on my server with the following message
$perl bin/app.pl Use of uninitialized value in numeric gt (>) at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/ Loader.pm line 718, [...] Loader.pm line 407, <$IN> line 1. Unable to parse the configuration file: /Users/punkish/Sites/app/config.yml: YAML Error: Invalid element in map Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT Line: 9 Document: 1 at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML. pm line 36 at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/Dance r/Config.pm line 204
[...]
Hmm.
Do you know what version of YAML.pm you have installed on your server? If it's not the latest, could you try updating it, and see if the problem persists?
Can you see if you can parse the YAML directly, without Dancer's involvement?
E.g.:
perl -MData::Dump=pp -MYAML -E 'say pp(YAML::LoadFile("config.yml"));'
Update YAML from 0.73 to 0.77 punkish@strata ~/Sites/pbdb$cpanm YAML --> Working on YAML Fetching http://search.cpan.org/CPAN/authors/id/I/IN/INGY/YAML-0.77.tar.gz ... OK Configuring YAML-0.77 ... OK Building and testing YAML-0.77 ... OK Successfully installed YAML-0.77 (upgraded from 0.73) 1 distribution installed Checked directly with YAML... no joy punkish@strata ~/Sites/pbdb$perl -MData::Dump=pp -MYAML -E 'say pp(YAML::LoadFile("config.yml"));' Use of uninitialized value in numeric gt (>) at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/Loader.pm line 716, <$IN> line 1. Use of uninitialized value in numeric gt (>) at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/Loader.pm line 717, <$IN> line 1. Use of uninitialized value in numeric gt (>) at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/Loader.pm line 717, <$IN> line 1. Use of uninitialized value in numeric ne (!=) at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/Loader.pm line 719, <$IN> line 1. Use of uninitialized value in subtraction (-) at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/Loader.pm line 724, <$IN> line 1. Use of uninitialized value in numeric eq (==) at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/Loader.pm line 359, <$IN> line 1. Use of uninitialized value in numeric eq (==) at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/Loader.pm line 359, <$IN> line 1. Use of uninitialized value in numeric eq (==) at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/Loader.pm line 359, <$IN> line 1. Use of uninitialized value in substitution (s///) at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/Loader.pm line 329, <$IN> line 1. Use of uninitialized value in substitution (s///) at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/Loader.pm line 336, <$IN> line 1. Use of uninitialized value in substitution (s///) at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/Loader.pm line 340, <$IN> line 1. Use of uninitialized value in substitution (s///) at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/Loader.pm line 405, <$IN> line 1. Use of uninitialized value in substitution (s///) at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/Loader.pm line 405, <$IN> line 1. YAML Error: Invalid element in map Code: YAML_LOAD_ERR_BAD_MAP_ELEMENT Line: 9 Document: 1 at /Users/punkish/perl5/perlbrew/perls/perl-5.14.1/lib/site_perl/5.14.1/YAML/Loader.pm line 352 Opened the file again in vi and `:set list`, and bingo! there was a character that looked like ^I, a result of pressing 'tab' Seems like YAML doesn't like tabs. I deleted that character, and now everything is well. Many thanks, -- Puneet Kishor