wikiprep syntax error: Use of the encoding pragma is deprecated

1.5k Views Asked by At

I am trying to use wikiprep (https://github.com/avian2/wikiprep) to parse wikipedia dump (in Feb 2014) and generate a XXX.hgw.xml file from the dump.

I followed the usage on Github site above: installed all Perl modules as prerequisites; Build and install wikiprep successfully (wikiprep program appeared in perl5/bin directory). When I execute wikiprep, it says:

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.

This the line 9:

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

Expected output: options I can use with wikiprep. I also cannot make test for the program. I installed it on Ubuntu 14.04 LTS. My Perl version is 5.18.02.

I don't know anything about perl language so I can't do anything with the "syntax error" here!

2

There are 2 best solutions below

0
On

In /usr/local/bin/ wikiprep change line 135 i'e (Wikiprep::Templates->import qw( %templates includeTemplates );) to : Wikiprep::Templates->import(qw( %templates includeTemplates ));

and in file /usr/local/share/perl/5.18.2/Wikiprep/Disambig.pm change Wikiprep::Link->import qw/ extractWikiLinks /; to Wikiprep::Link->import(qw/ extractWikiLinks /);

1
On

You may need enable ut8 in your script. PLace this two lines before you start using this module:

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