问题:发现一个违反缩进的制表符

时间:2011-01-23 04:17:46

标签: perl yaml indentation cpan

./run-bot
Running bot 22496
Error parsing ./shittybot.yml: YAML::XS::Load Error: The problem:

    found a tab character that violate intendation

was found at /usr/local/lib/perl5/site_perl/5.10.1/Config/Any.pm line 201
        Config::Any::_load('Config::Any', 'HASH(0x8de4708)') called at /usr/local/lib/perl5/site_perl/5.10.1/Config/Any.pm line 94
        Config::Any::load_files('Config::Any', 'HASH(0x8de4708)') called at /usr/local/lib/perl5/site_perl/5.10.1/Config/JFDI/Source/Loader.pm line 104
        Config::JFDI::Source::Loader::_load_files('Config::JFDI::Source::Loader=HASH(0x85e1d48)', 'ARRAY(0x8de4f48)') called at /usr/local/lib/perl5/site_perl/5.10.1/Config/JFDI/Source/Loader.pm line 62
        Config::JFDI::Source::Loader::read('Config::JFDI::Source::Loader=HASH(0x85e1d48)') called at /usr/local/lib/perl5/site_perl/5.10.1/Config/JFDI.pm line 153
        Config::JFDI::load('Config::JFDI=HASH(0x85e67c0)') called at /usr/local/lib/perl5/site_perl/5.10.1/Config/JFDI.pm line 140
        Config::JFDI::config('Config::JFDI=HASH(0x85e67c0)') called at /usr/local/lib/perl5/site_perl/5.10.1/Config/JFDI.pm line 131
        Config::JFDI::get('Config::JFDI=HASH(0x85e67c0)') called at bot.pl line 32

我该如何解决这个问题?

编辑:我认为我修改了缩进,但现在我收到了这个错误:

Error parsing ./shittybot.yml: YAML::XS::Load Error: The problem:

    found character that cannot start any token

was found at /usr/local/lib/perl5/site_perl/5.10.1/Config/Any.pm line 201
        Config::Any::_load('Config::Any', 'HASH(0xa3da738)') called at /usr/local/lib/perl5/site_perl/5.10.1/Config/Any.pm line 94
        Config::Any::load_files('Config::Any', 'HASH(0xa3da738)') called at /usr/local/lib/perl5/site_perl/5.10.1/Config/JFDI/Source/Loader.pm line 104
        Config::JFDI::Source::Loader::_load_files('Config::JFDI::Source::Loader=HASH(0x9bd7d48)', 'ARRAY(0xa3daf78)') called at /usr/local/lib/perl5/site_perl/5.10.1/Config/JFDI/Source/Loader.pm line 62
        Config::JFDI::Source::Loader::read('Config::JFDI::Source::Loader=HASH(0x9bd7d48)') called at /usr/local/lib/perl5/site_perl/5.10.1/Config/JFDI.pm line 153
        Config::JFDI::load('Config::JFDI=HASH(0x9bdc7c0)') called at /usr/local/lib/perl5/site_perl/5.10.1/Config/JFDI.pm line 140
        Config::JFDI::config('Config::JFDI=HASH(0x9bdc7c0)') called at /usr/local/lib/perl5/site_perl/5.10.1/Config/JFDI.pm line 131
        Config::JFDI::get('Config::JFDI=HASH(0x9bdc7c0)') called at bot.pl line 32

2 个答案:

答案 0 :(得分:3)

  1. 用标签替换所有空格
  2. 确保所有内容都正确缩进。

答案 1 :(得分:3)

使用您的pastebin文件。

apv@cassidy[421]~/>perl -MYAML::XS=LoadFile -le 'LoadFile(+shift)' S1tuACcg.txt
             YAML::XS::Load Error: The problem:

    found a tab character that violate intendation

was found at document: 1, line: 8, column: 1
while scanning a plain scalar at line: 7, column: 18    
apv@cassidy[422]~/>perl -lne 'print "TAB!" if /\t/' S1tuACcg.txt
TAB!
TAB!
TAB!
apv@cassidy[423]~/>perl -pi -e 's/\t/        /' S1tuACcg.txt
apv@cassidy[424]~/>perl -MYAML::XS=LoadFile -le \
   'LoadFile(+shift) and print "OK!"' S1tuACcg.txt
OK!

我怀疑如果你升级你的YAML :: XS(我的0.34),你会看到我的例子显示的更好的错误反馈。