【问题标题】:wikiprep syntax error: Use of the encoding pragma is deprecatedwikiprep 语法错误:不推荐使用编码编译指示
【发布时间】:2014-08-01 05:45:13
【问题描述】:

我正在尝试使用 wikiprep (https://github.com/avian2/wikiprep) 来解析 wikipedia 转储(2014 年 2 月)并从转储生成 XXX.hgw.xml 文件。

我按照上面 Github 网站上的用法:安装所有 Perl 模块作为先决条件;成功构建并安装 wikiprep(wikiprep 程序出现在 perl5/bin 目录中)。当我执行wikiprep 时,它说:

Use of the encoding pragma is deprecated at /home/tutran/perl5/bin/wikiprep line 32. Use of the encoding pragma is deprecated at /home/tutran/perl5/lib/perl5/Wikiprep/languages.pm line 7. syntax error at /home/tutran/perl5/lib/perl5/Wikiprep/Disambig.pm line 9, near "->import qw/ extractWikiLinks /" Compilation failed in require at /home/tutran/perl5/bin/wikiprep line 52. BEGIN failed--compilation aborted at /home/tutran/perl5/bin/wikiprep line 52.

这是第 9 行:

Wikiprep::Link->import qw/ extractWikiLinks /;

预期输出:我可以在 wikiprep 中使用的选项。我也无法对该程序进行测试。我将它安装在 Ubuntu 14.04 LTS 上。我的 Perl 版本是 5.18.02。

我对 perl 语言一无所知,所以我对这里的“语法错误”无能为力!

【问题讨论】:

    标签: perl mediawiki zemanta


    【解决方案1】:

    您可能需要在脚本中启用 ut8。在开始使用此模块之前放置这两行:

    use utf8;
    use open qw( :encoding(cp866) :std );
    

    【讨论】:

    • 我应该把这个放在哪里?在第 9 行之前的Wikiprep/Disambig.pm 中,还是在其他地方?
    【解决方案2】:

    在 /usr/local/bin/ wikiprep 中将第 135 行,即 (Wikiprep::Templates->import qw( %templates includeTemplates );) 更改为: Wikiprep::Templates->import(qw( %templates includeTemplates ));

    和 在文件中 /usr/local/share/perl/5.18.2/Wikiprep/Disambig.pm 改变 Wikiprep::Link->import qw/ extractWikiLinks /;至 Wikiprep::Link->import(qw/ extractWikiLinks /);

    【讨论】:

      猜你喜欢
      • 2015-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-02-26
      • 1970-01-01
      • 2013-06-01
      • 2016-07-24
      相关资源
      最近更新 更多