Bugzilla-VCS installation Error in Extension.pm - perl

While installing the bugzilla-vcs extension for SVN integration on My windows server 2008, I have encountered this issue. After a lot of searching on google i have finally run out of options. Can somebody assist me in resolving this issue. I am absolutely unfamiliar with perl so am not able to do much this error. The error log is as follows...
Checking for MySQL (v5.0.15) ok: found v5.6.10-log
"my" variable $vcs_repos masks earlier declaration in same scope at ./extensions/VCS/Extension.pm line 180.
"state" variable #_ masks earlier declaration in same scope at ./extensions/VCS/Extension.pm line 196.
"my" variable $self masks earlier declaration in same scope at ./extensions/VCS/Extension.pm line 208.
"state" variable #_ masks earlier declaration in same scope at ./extensions/VCS/Extension.pm line 208.
syntax error at ./extensions/VCS/Extension.pm line 145, near "$type qw(Bzr Cvs Git Hg Svn)"
Global symbol "$type" requires explicit package name at ./extensions/VCS/Extension.pm line 147.
syntax error at ./extensions/VCS/Extension.pm line 172, near "}"
Can't use global #_ in "my" at ./extensions/VCS/Extension.pm line 179, near "= #_"
syntax error at ./extensions/VCS/Extension.pm line 189, near "}"
Can't use global #_ in "my" at ./extensions/VCS/Extension.pm line 196, near "= #_"
syntax error at ./extensions/VCS/Extension.pm line 201, near "}"
Can't use global #_ in "my" at ./extensions/VCS/Extension.pm line 208, near "= #_"
Global symbol "$args" requires explicit package name at ./extensions/VCS/Extension.pm line 209.
syntax error at ./extensions/VCS/Extension.pm line 211, near "}"
./extensions/VCS/Extension.pm has too many errors.
Compilation failed in require at Bugzilla/Extension.pm line 68.

It was able to solve the syntax error issues with a couple very minor code edits on Ubuntu I expect the same would work on windows but I haven't tried it.
in VCS/Extension.pm line 145
change
foreach my $typl qw(Bzr Cvs Git Hg Svn) {
to
my #types = qw(Bzr Cvs Git Hg Svn);
foreach my $type (#types) {
and VCS/lib/Commit.pm line 130
foreach my $key qw(revision revno author message uuid) {
to
my #keys = qw(revision revno author message uuid);
foreach my $key (#keys) {

Related

DateTime Won't Load Properly Unless a Module Using Moo Launches First

I'm cleaning up code and removed the now deprecated Forecast::IO module from my Perl script. When I did, I started getting this error:
[root#server cgi-bin]# perl Weather.pm
Undefined subroutine &B::perlstring called at /usr/local/share/perl5/Params/ValidationCompiler/Compiler.pm line 248.
Compilation failed in require at /usr/local/lib64/perl5/DateTime.pm line 13.
BEGIN failed--compilation aborted at /usr/local/lib64/perl5/DateTime.pm line 13.
Compilation failed in require at Weather.pm line 1340.
BEGIN failed--compilation aborted at Weather.pm line 1340.
Line 1340 where the error occurs is innocuously enough, use DateTime;.
I wasn't sure what DateTime could be up to that would cause it to be upset I wasn't using the unrelated Forecast::IO module any longer, so I started taking apart the latter module to figure out what code was preventing the error. The essential part seems to be that Moo is included in Forecast::IO and it has at least one Moo has declaration:
package Forecast::IO;
use Moo;
has testkey => ( is => 'ro' );
1;
For some reason, if that module with at least those lines exists, DateTime loads fine. Otherwise, the error I mentioned above occurs, choking on DateTime's line 13, use Carp;. Even if I put use Moo; has testkey => ( is => 'ro' ); into my own module, it fails upon use DateTime.
Even though I've used grep -r Forecast::IO to traverse the codebase to look for some errant reference and come up empty. So, I decided to try to just load the DateTime module: perl -MDateTime. That too produces the error:
[root#server cgi-bin]# perl -MDateTime
Undefined subroutine &B::perlstring called at /usr/local/share/perl5/Params/ValidationCompiler/Compiler.pm line 248.
Compilation failed in require at /usr/local/lib64/perl5/DateTime.pm line 13.
BEGIN failed--compilation aborted at /usr/local/lib64/perl5/DateTime.pm line 13.
Compilation failed in require.
BEGIN failed--compilation aborted.

Perl 5.14.2-7u21deb - Error with ConfigLocal.pm (Number found where operator expected)

i've been expiriencing a strange issue and can't figure out the cause.
I'm trying to check an ESXi Host with the Nagiosplugin check_esx3
Whenever i call the script, i get a proper return, but right before i get the Error as follows:
Number found where operator expected at /usr/local/lib/perl/5.14.2/Encode/ConfigLocal.pm line 13, near "$_ModLines_
1"
(Missing semicolon on previous line?)
Since any other interaction with Perl runs into same scenario, it migt be something at the very basic. Unluckily im not tat familiar with Perl.
Trying to call "enc2xs -C" i get :
Number found where operator expected at /usr/local/lib/perl/5.14.2/Encode/ConfigLocal.pm line 13, near "$_ModLines_
1"
(Missing semicolon on previous line?)
require Encode;
require Encode;
require Encode::Symbol;
require Encode::Byte;
require Encode::Config;
require Encode::Encoder;
require Encode::EBCDIC;
require Encode::Alias;
require Encode::ConfigLocal;
Can't require Encode::ConfigLocal: Attempt to reload Encode/ConfigLocal.pm aborted.
Compilation failed in require at (eval 16) line 1.
Content of /usr/local/lib/perl/5.14.2/Encode/ConfigLocal.pm :
#
# Local demand-load module list
#
# You should not edit this file by hand! use "enc2xs -C"
#
package Encode::ConfigLocal;
our $VERSION = $_LocalVer_;
use strict;
$_ModLines_
1;
Perlversion info:
Built under linux
Compiled at Sep 30 2013 03:45:34
%ENV:
PERL_LWP_SSL_VERIFY_HOSTNAME="0"
#INC:
/etc/perl
/usr/local/lib/perl/5.14.2
/usr/local/share/perl/5.14.2
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.14
/usr/share/perl/5.14
/usr/local/lib/site_perl
.
Just remove /usr/local/lib/perl/5.14.2/Encode/ConfigLocal.pm. It's optional (see the source code of Encode.pm, the require Encode::ConfigLocal is wrapped in an eval block) and not part of normal perl installations. enc2xs -C would create a new Encode::ConfigLocal, but apparently there's a bug which creates an invalid file. Anyway, unless you really think you need it, just remove it.
As said in the error message, a semicolon is missing on previous line:
package Encode::ConfigLocal;
our $VERSION = $_LocalVer_;
use strict;
$_ModLines_;
# here __^
1;

Compilation errors when connecting to MongoDB from Perl

I'm trying to run the simple "MongoDB:Tutorial" tutorial:
http://search.cpan.org/dist/MongoDB/lib/MongoDB/Tutorial.pod
My goal is to connect to a MongoDB database from a Perl script. I've installed MongoDB using cpanm:
$ sudo cpanm MongoDB
MongoDB is up to date. (0.501.1)
I created a simple Perl script called loadRaw.pl:
use strict;
use warnings;
use MongoDB;
use MongoDB::Connection;
use MongoDB::OID;
print "hello\n";
When I try to run the script, I get a bunch of errors:
$ perl ./loadRaw.pl
String found where operator expected at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 271, near "confess "cannot set fields after querying""
(Do you need to predeclare confess?)
String found where operator expected at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 273, near "confess 'not a hash reference'"
(Do you need to predeclare confess?)
String found where operator expected at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 294, near "confess "cannot set sort after querying""
(Do you need to predeclare confess?)
String found where operator expected at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 296, near "confess 'not a hash reference'"
(Do you need to predeclare confess?)
String found where operator expected at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 317, near "confess "cannot set limit after querying""
(Do you need to predeclare confess?)
String found where operator expected at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 343, near "confess "Cannot set tailable state""
(Do you need to predeclare confess?)
String found where operator expected at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 366, near "confess "cannot set skip after querying""
(Do you need to predeclare confess?)
String found where operator expected at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 390, near "confess "cannot set snapshot after querying""
(Do you need to predeclare confess?)
String found where operator expected at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 408, near "confess "cannot set hint after querying""
(Do you need to predeclare confess?)
String found where operator expected at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 410, near "confess 'not a hash reference'"
(Do you need to predeclare confess?)
syntax error at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 90, near "has started_iterating"
syntax error at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 271, near "confess "cannot set fields after querying""
syntax error at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 294, near "confess "cannot set sort after querying""
syntax error at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 317, near "confess "cannot set limit after querying""
syntax error at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 343, near "confess "Cannot set tailable state""
syntax error at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 366, near "confess "cannot set skip after querying""
syntax error at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 390, near "confess "cannot set snapshot after querying""
syntax error at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 408, near "confess "cannot set hint after querying""
BEGIN not safe after errors--compilation aborted at /usr/local/lib/perl/5.10.1/MongoDB/Cursor.pm line 564.
Compilation failed in require at /usr/local/lib/perl/5.10.1/MongoDB/Connection.pm line 26.
BEGIN failed--compilation aborted at /usr/local/lib/perl/5.10.1/MongoDB/Connection.pm line 26.
Compilation failed in require at /usr/local/lib/perl/5.10.1/MongoDB.pm line 30.
BEGIN failed--compilation aborted at /usr/local/lib/perl/5.10.1/MongoDB.pm line 30.
Compilation failed in require at ./loadRaw.pl line 7.
BEGIN failed--compilation aborted at ./loadRaw.pl line 7.
It seems like the MongoDB Perl module (specifically, the Cursor.pm file) has some syntax errors. The first batch of problems (those related to the confess keyword) are solved if I add the line use Carp; to the top of Cursor.pm. However, I don't think I should have to do this, and instead I'm doing something else incorrectly. Also, the second batch of errors (those related to the has keyword) are not solved by including Carp.
Has anyone else experienced this? Any ideas?
I never found out exactly what was going wrong, but it was surely unique to my system and my Perl configuration. Since others were able to execute the provided code without problem, I tried executing the code using Perlbrew (as suggested by friedo):
$ perlbrew install perl-5.16.0
(Output not shown)
$ perlbrew switch perl-5.16.0
(Output not shown)
$ perlbrew install-cpanm
(Output not shown)
$ /home/sthomas/perl5/perlbrew/bin/cpanm MongoDB
(Output not shown)
$ perlbrew exec perl ./loadRaw.pl
perl-5.16.0
==========
hello
Since it works fine with a Perlbrew installation, the problem is not with MongoDB or my sample code; it must be some weird quirk of my Perl environment. I guess I'll try a fresh install of Perl and all my required modules and see if that works.

What's wrong with this Perl module?

I am making a very, very simple module (it is the first I've ever wrote):
package Master::Math;
use 5.12.4;
use strict;
use warnings;
require Exporter;
our #ISA = qw(Exporter)
our %EXPORT_TAGS = (
'all' => [ qw(
max
=cut
1; # End of Master::Math
When I run use this in my program, I get the error
Invalid version format (non-numeric data) at C:/Perl/lib/Master/Math.pm line 3,
near "package Master::Math
"
syntax error at C:/Perl/lib/Master/Math.pm line 3, near "package Master::Math
require Exporter"
Compilation failed in require at C:\MainDev\myperl\max.pl line 3.
BEGIN failed--compilation aborted at C:\MainDev\myperl\max.pl line 3.
What do I need to fix this? Thanks!
You're missing a semicolon on the declaration of #ISA.
In sub max, $foo is undeclared; use foreach my $foo ....
That should get it to compile. I haven't looked beyond that.
(BTW, I didn't get the same errors you did. I used perl 5.14.0, perl -cw master-math.pm.)

Getting compilation errors in Catalyst framework in Ubuntu

I am building an application on Catalyst framework and I am a complete novice at it. Yesterday I installed SQLite and since then I am getting error messages like:
mohit#mohit-Studio-1555:~$ catalyst.pl
Undefined subroutine &Catalyst::Exception::Base::with called at /usr/share/perl5/Catalyst/Exception.pm line 50.
Compilation failed in require at /usr/share/perl5/Catalyst/Utils.pm line 4.
BEGIN failed--compilation aborted at /usr/share/perl5/Catalyst/Utils.pm line 4.
Compilation failed in require at /usr/share/perl5/Catalyst/Helper.pm line 12.
BEGIN failed--compilation aborted at /usr/share/perl5/Catalyst/Helper.pm line 12.
Compilation failed in require at /usr/bin/catalyst.pl line 26.
BEGIN failed--compilation aborted at /usr/bin/catalyst.pl line 26.
I tried reinstalling, cleaning and tried to google it but unable to resolve.
Please help me out. What can be the problem?
After upgrading namespace::clean I get this error:
The old Moose::Util::MetaRole API (before version 0.94) has been deprecated at /usr/share/perl5/Catalyst/Exception/Basic.pm line 3
Catalyst::Exception::Basic::BEGIN() called at /usr/lib/perl5/MooseX/Role/WithOverloading.pm line 3
eval {...} called at /usr/lib/perl5/MooseX/Role/WithOverloading.pm line 3
require Catalyst/Exception/Basic.pm called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 114
Class::MOP::__ANON__() called at /usr/local/share/perl/5.10.1/Try/Tiny.pm line 71
eval {...} called at /usr/local/share/perl/5.10.1/Try/Tiny.pm line 67
Try::Tiny::try('CODE(0x8f366b8)', 'Try::Tiny::Catch=REF(0x8e6b9c8)') called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 125
Class::MOP::load_first_existing_class('Catalyst::Exception::Basic') called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 137
Class::MOP::load_class('Catalyst::Exception::Basic', undef) called at /usr/local/lib/perl/5.10.1/Moose/Util.pm line 113
Moose::Util::_apply_all_roles('Moose::Meta::Class=HASH(0x8f36458)', undef, 'Catalyst::Exception::Basic') called at /usr/local/lib/perl/5.10.1/Moose/Util.pm line 91
It looks like you installed a version of Package::Stash which breaks your installed version of namespace::clean and didn't catch the conflict warning. Upgrading namespace::clean to the newest version should resolve your problems.