Re: Compilation failed in require
by BrowserUk (Patriarch) on Aug 12, 2013 at 11:06 UTC
|
The problem appears to be a relatively simple coding error in Wiktionary::Parser::Language.
When it uses Locale::Codes::Language, is disables imports: use Locale::Codes::Language qw(); and attempts to obtain access to the constants, that would have been imported, by using fully qualified names:
my @all_names_3 = Locale::Codes::Language::all_language_names(Locale::
+Codes::Language::LOCALE_LANG_ALPHA_3);
The problem appears to be that those exports do not originate in that module, but rather are themselves imported from Locale::Codes::Constants.
The real question here is how could Wiktionary::Parser work anywhere, regardless of how it was installed, given such a fundamental programming error?
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] [select] |
|
(Wiktionary::Parser author here)
I've never tested this package on a Windows platform, but I'm pretty tickled that it worked as well as it did. I've mainly run the code on various versions of CentOS on perl 5.8 and 5.16 and never ran into any of the above issues.
I pushed a few updates to try to fix some of them but since I can't recreate these errors I'm a bit blind as to whether it'll be effective.
The latest version of Wikionary::Parser (v0.10) is available on github here right now: https://github.com/clbecker/perl-wiktionary-parser
And should be on cpan as soon as it gets indexed. (If any of you have a better patch, let me know and I'll be happy to merge it in)
| [reply] |
|
| [reply] |
|
Re: Compilation failed in require
by BrowserUk (Patriarch) on Aug 12, 2013 at 08:27 UTC
|
| [reply] |
|
What is the "error message"?
When I tried the OP's code here locally, I got:
Bareword "Locale::Codes::Language::LOCALE_LANG_ALPHA_3" not allowed wh
+ile "strict subs" in use at /home/soeren/perl5/lib/perl5/Wiktionary/P
+arser/Language.pm line 49.
Compilation failed in require at /home/soeren/perl5/lib/perl5/Wiktiona
+ry/Parser/Section.pm line 8.
BEGIN failed--compilation aborted at /home/soeren/perl5/lib/perl5/Wikt
+ionary/Parser/Section.pm line 8.
Compilation failed in require at /home/soeren/perl5/lib/perl5/Wiktiona
+ry/Parser/Document.pm line 6.
BEGIN failed--compilation aborted at /home/soeren/perl5/lib/perl5/Wikt
+ionary/Parser/Document.pm line 6.
Compilation failed in require at /home/soeren/perl5/lib/perl5/Wiktiona
+ry/Parser.pm line 8.
BEGIN failed--compilation aborted at /home/soeren/perl5/lib/perl5/Wikt
+ionary/Parser.pm line 8.
Compilation failed in require at test.pl line 2.
BEGIN failed--compilation aborted at test.pl line 2.
YMMV...
Cheers, Sören
Créateur des bugs mobiles - let loose once, run everywhere.
(hooked on the Perl Programming language)
| [reply] [d/l] |
|
| [reply] |
Re: Compilation failed in require
by Khen1950fx (Canon) on Aug 12, 2013 at 10:22 UTC
|
First,
Wiktionary::Parser has few dependencies that
need to updated before you install the parser. In a nutshell:
#!/usr/bin/perl
use strict;
use warnings;
use CPAN;
my (@mods) = qw(
File::Path
Text::Unidecode
JSON
WWW::RobotRules
HTTP::Cookies
Net::FTP
Net::HTTP
IO::Socket
HTTP::Daemon
Digest::MD5
HTML::Tagset
XSLoader
HTML::Entities
HTTP::Negotiate
File::Listing
Time::Local
HTTP::Date
Bundle::Compress::Zlib
File::Temp
Exporter
Scalar::Util
IO::HTML
IO::Uncompress::Inflate
HTTP::Status
Encode
Encode::Locale
LWP::MediaTypes
Test
MIME::Base64
URI::EScape
LWP::UserAgent
MediaWiki::API
Carp
Spiffy
ExtUtils::MakeMaker
Filter::Util::Call
Test::More
Test::Base
Test::CheckManifest
Carp::Always
Locale::Codes
Wiktionary::Parser
);
foreach my $mod (@mods) {
CPAN::Shell->install($mod);
}
Second, don't forget to use a dumper. I used
Data::Dumper::Concise.
Using your script, I use derived_terms and synonyms:
#!/usr/local/bin/perl -l
use strict;
use warnings;
use Wiktionary::Parser;
use Data::Dumper::Concise;
my $parser = Wiktionary::Parser->new();
my $document = $parser->get_document( title => 'bunny' );
my $derived_words = $document->get_derived_terms();
my $synonyms = $document->get_synonyms();
print Dumper( $derived_words, $synonyms );
| [reply] [d/l] [select] |
|
OP used PPM, prerequsites are installed via PPM. Why have you scripted a cpan install when running cpan Wiktionary::Parser from the command line will do the same thing?
Also note that OP said he was on Windows 7 64 bit, if they're using 64 bit ActiveState Perl no C compiler or build tools are installed by default, and aren't available on the 64bit platform from PPM. So without them manualling installing all this your suggestion of a cpan installation may fail.
Update: Added link. Slight rewording for clarity
| [reply] [d/l] |
|
First, Wiktionary::Parser has few dependencies that need to updated before you install the parser.
First, when you "installed Wiktionary::Parser on a Windows7 64bit operating system through ppm", PPM should have resolved and installed all dependencies when it was built on the PPM server (by ActiveState or whomever runs the PPM server).
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] |
|
Hi
After installing all of Wiktionary::Parser dependencies, I do not get the error message as before, so it seems to have worked.
However when I try to run the script that you posted (I had a look at Wiktionary::Parser documentation and it looks correct), I get a new error message- 'Can't call method "get_derived_terms" on an undefined value at \some\dir\script.pl line 12'. Any ideas?
Thank you for the help in my previous post, much appreciated
| [reply] |
|
The documentation is incorrect. You should have gotten this output:
{
en => [
"angst bunny",
"badge bunny",
"bunny girl",
"bunny rabbit",
"cuddle bunny",
"dust bunny",
"Easter Bunny",
"gym bunny",
"snuggle bunny",
"that's the bunny",
"bunny wunny",
"snow bunny"
]
}
{
en => {
language => "English",
sense => {
"easy, unchallenging, of a slope" => [
"nursery"
],
"resembling a bun" => [
"bunlike"
]
}
}
}
You'll have to improvise:) | [reply] [d/l] |
Re: Compilation failed in require
by Anonymous Monk on Nov 30, 2013 at 13:57 UTC
|
So the latest version of Wiktionary::Parser (0.11) should have fixed this error. In previous versions, the cpan testers reports for perl 5.14 on a number of platforms were showing the same issue, all of which are passing now. If the root cause was the same then this case should be resolved too. | [reply] |