与DateTime :: Format :: ISO8601的Perl问题被跟踪以发现Params :: Validate?

时间:2012-02-07 15:11:48

标签: linux perl cpan

希望有人可以对此有所了解......

我和团队中的许多其他开发人员都有大规模的内部perl app运行。尽管这一切都很好,但是对于每个人的笔记本电脑(Linux和Mac),我都不能在我的生活中在家里的大电脑上运行。

我已经通过cpan安装了所有依赖项,但是在访问该站点时我在apache错误日志中得到以下内容:

The 'regex' parameter ("(?x-ism:^ (\d{4}) (\d\d) (\d\d) $)") to DateTime::Format::Builder::Parser::create_single_parser was an 'unknown', which is not one of the allowed types: scalarref
 at /usr/local/lib/perl/5.12.4/Params/ValidatePP.pm line 651
    Params::Validate::__ANON__('The \'regex\' parameter ("(?x-ism:^ (\d{4}) (\d\d) (\d\d) $)"...') called at /usr/local/lib/perl/5.12.4/Params/ValidatePP.pm line 491
    Params::Validate::_validate_one_param('Regexp=REGEXP(0x7f8a3aad06e8)', 'HASH(0x7f8a3aaea840)', 'HASH(0x7f8a3aa75aa8)', 'The \'regex\' parameter ("(?x-ism:^ (\d{4}) (\d\d) (\d\d) $)")') called at /usr/local/lib/perl/5.12.4/Params/ValidatePP.pm line 353
    Params::Validate::validate('ARRAY(0x7f8a3aa33808)', 'HASH(0x7f8a3aa32db8)') called at /usr/local/share/perl/5.12.4/DateTime/Format/Builder/Parser.pm line 312
    DateTime::Format::Builder::Parser::create_single_parser(undef, 'params', 'ARRAY(0x7f8a3aad0640)', 'length', 8, 'regex', 'Regexp=REGEXP(0x7f8a3aad06e8)') called at /usr/local/share/perl/5.12.4/DateTime/Format/Builder/Parser.pm line 504
    DateTime::Format::Builder::Parser::sort_parsers('DateTime::Format::Builder::Parser', 'HASH(0x7f8a3aa4e2b8)', 'ARRAY(0x7f8a3aa3f148)') called at /usr/local/share/perl/5.12.4/DateTime/Format/Builder/Parser.pm line 398
    DateTime::Format::Builder::Parser::create_multiple_parsers('DateTime::Format::Builder::Parser', 'HASH(0x7f8a3aa4e2b8)', 'HASH(0x7f8a3aad06b8)', 'HASH(0x7f8a3aad0808)', 'HASH(0x7f8a3aad0910)', 'HASH(0x7f8a3aad0a00)', 'HASH(0x7f8a3aad0b08)', 'HASH(0x7f8a3aad0cb8)', 'HASH(0x7f8a3aad0e50)', ...) called at /usr/local/share/perl/5.12.4/DateTime/Format/Builder/Parser.pm line 603
    DateTime::Format::Builder::Parser::create_parser('DateTime::Format::Builder::Parser', 'ARRAY(0x7f8a3a72fc88)', 'HASH(0x7f8a3aad06b8)', 'HASH(0x7f8a3aad0808)', 'HASH(0x7f8a3aad0910)', 'HASH(0x7f8a3aad0a00)', 'HASH(0x7f8a3aad0b08)', 'HASH(0x7f8a3aad0cb8)', 'HASH(0x7f8a3aad0e50)', ...) called at /usr/local/share/perl/5.12.4/DateTime/Format/Builder.pm line 158
    DateTime::Format::Builder::create_parser('DateTime::Format::Builder', 'ARRAY(0x7f8a3aae5450)') called at /usr/local/share/perl/5.12.4/DateTime/Format/Builder.pm line 177
    DateTime::Format::Builder::create_end_parser('DateTime::Format::Builder', 'ARRAY(0x7f8a3aae5450)') called at /usr/local/share/perl/5.12.4/DateTime/Format/Builder.pm line 106
    DateTime::Format::Builder::create_class(undef, 'parsers', 'HASH(0x7f8a3aae8f18)') called at /usr/local/share/perl/5.12.4/DateTime/Format/ISO8601.pm line 175

我已经在print STDERR中直接点了一些noddy ValidatePP.pm,所以如果你看的是行号而且它们稍微有点,但基本上在ValidatePP.pmsub _get_type中的以下代码块:

 # I really hope this never happens.
 return UNKNOWN;

如果有帮助,运行perl -v会在此PC上返回以下版本

  

这是perl 5,版本12,颠覆4(v5.12.4)   x86_64的-Linux的GNU线程的多

任何人

更新:

如果有帮助,子例程_get_type基本上决定(使用UNIVERSAL::isa)如果以下regex: !!perl/regexp (?x-ism:^ (\d{4}) (\d\d) (\d\d) $)不是一个:

my %isas = (
        'ARRAY'  => ARRAYREF,
        'HASH'   => HASHREF,
        'CODE'   => CODEREF,
        'GLOB'   => GLOBREF,
        'SCALAR' => SCALARREF,
    );

1 个答案:

答案 0 :(得分:1)

首先,您使用的是最新版本的Params::Validate(以及所有其他模块)吗? 根据{{​​3}},P :: V 1.01中存在一些错误:

  

1.02 2012-02-06

     
      
  • 以前的版本从未加载过XS实现,即使它已经存在   编译。

  •   
  • 对于更新版本的Perl,纯Perl实现处理了regexp   对象与XS实现不同。他们应该被视为   属于SCALARREF类型以实现向后兼容。

  •   
  • 这两个错误组合成功打破了许多测试套件   CPAN上的模块。此版本应修复它们。

  •