Getting compilation errors in Catalyst framework in Ubuntu - perl

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.

Related

Getting error while executing makeinfo on cygwin

While executing makeinfo on cygwin I am getting the following errors. I am using the perl version 5.32.1
23:16 Harshal:~> makeinfo
Can't locate if.pm in #INC (you may need to install the if module) (#INC contains: /usr/lib/texinfo /usr/share/texinfo/lib/Text-Unidecode/lib /usr/share/texinfo/lib/Unicode-EastAsianWidth/lib /usr/share/texinfo/lib/libintl-perl/lib /usr/share/texinfo /usr/share/texinfo /usr/local/lib/perl5/site_perl/5.32/x86_64-cygwin-threads /usr/local/share/perl5/site_perl/5.32 /usr/lib/perl5/vendor_perl/5.32/x86_64-cygwin-threads /usr/share/perl5/vendor_perl/5.32 /usr/lib/perl5/5.32/x86_64-cygwin-threads /usr/share/perl5/5.32) at /usr/share/texinfo/Texinfo/Structuring.pm line 27.
BEGIN failed--compilation aborted at /usr/share/texinfo/Texinfo/Structuring.pm line 27.
Compilation failed in require at /usr/share/texinfo/Texinfo/Convert/Converter.pm line 32.
BEGIN failed--compilation aborted at /usr/share/texinfo/Texinfo/Convert/Converter.pm line 32.
Compilation failed in require at /usr/bin/makeinfo line 99.
BEGIN failed--compilation aborted at /usr/bin/makeinfo line 99.
If someone can provide some pointer on how to resolve this issue would be helpful
I tried updating the perl version. I tried commetting out the code on line num 27 in structuring.pm didn;t workout. I am not from software background but i need the above thing for some RISCV based toolchain update.
Any help woudl be really appreciated .
Something's wrong with your system. This is a file included in the perl-5.32.1-2 package. It should be found at
/usr/share/perl5/5.32/if.pm
Try reinstalling the perl package. If the file isn't missing, something's wrong with the permissions.

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 library issue while running script on different server

My perl script is working fine on Server 1 and same script is giving error on Server 2.
On both server I have same library but still it is giving error.
I have tried by setting LD_LIBRARY_PATH but still m getting same error.
The same script is running on Server 1 and not running on Server 2. Even after having the same OS and Kernel version.
Error(while running perl script related to perl lib load) is as below:
Can't load '/user/csm/64-bit/cpan/5.20.2-2014.10/lib/auto/Net/SSLeay/SSLeay.so' for module Net::SSLeay: libssl.so.1.0.0: cannot open shared object file: No such file or directory at /user/csm/64-bit/perl/5.20.2/lib/5.20.2/x86_64-linux-thread-multi/DynaLoader.pm line 193.
at /user/csm/64-bit/cpan/5.20.2-2014.10/lib/IO/Socket/SSL.pm line 19.
Compilation failed in require at /user/csm/64-bit/cpan/5.20.2-2014.10/lib/IO/Socket/SSL.pm line 19.
BEGIN failed--compilation aborted at /user/csm/64-bit/cpan/5.20.2-2014.10/lib/IO/Socket/SSL.pm line 19.
Compilation failed in require at /user/csm/64-bit/cpan/5.20.2-2014.10/lib/Net/HTTPS.pm line 26.
Can't load '/user/csm/64-bit/cpan/5.20.2-2014.10/lib/auto/Crypt/SSLeay/SSLeay.so' for module Crypt::SSLeay: libssl.so.1.0.0: cannot open shared object file: No such file or directory at /user/csm/64-bit/perl/5.20.2/lib/5.20.2/x86_64-linux-thread-multi/DynaLoader.pm line 193.
at /user/csm/64-bit/cpan/5.20.2-2014.10/lib/Net/SSL.pm line 20.
Compilation failed in require at /user/csm/64-bit/cpan/5.20.2-2014.10/lib/Net/SSL.pm line 20.
Compilation failed in require at /user/csm/64-bit/cpan/5.20.2-2014.10/lib/Net/HTTPS.pm line 30.
Compilation failed in require at /user/csm/64-bit/cpan/5.20.2-2014.10/lib/LWP/Protocol/https.pm line 8.
Compilation failed in require at (eval 43) line 2.

How to recover from interrupted CPAN module installation?

My computer crashed during a perl module installation using cpanm (I guess while installing Carp as a dependency of Moose). Now, when I try to use the modules I want to use, I get the following error:
user#linux:~$ ./script_using_moose.pl
Carp.pm did not return a true value at /usr/share/perl/5.14/diagnostics.pm line 185.
BEGIN failed--compilation aborted at /usr/share/perl/5.14/diagnostics.pm line 185.
Compilation failed in require at ./script_using_moose.pl line 5.
BEGIN failed--compilation aborted at ./script_using_moose.pl line 5.
user#linux:~$
And if I try to (re)install the package (using cpanm --reinstall or cpanm force) I get this other (similar) error:
user#linux:~$ sudo cpanm --force Moose
Carp.pm did not return a true value at /usr/local/share/perl/5.14.2/Parse/CPAN/Meta.pm line 6.
BEGIN failed--compilation aborted at /usr/local/share/perl/5.14.2/Parse/CPAN/Meta.pm line 6.
Compilation failed in require at /loader/0x1692090/App/cpanminus/script.pm line 11.
BEGIN failed--compilation aborted at /loader/0x1692090/App/cpanminus/script.pm line 11.
Compilation failed in require at /usr/bin/cpanm line 2029.
BEGIN failed--compilation aborted at /usr/bin/cpanm line 2029.
user#linux:~$
How can I resume installation or reconfigure/reinstall the incomplete module?
For some reason, a couple of files were created but not written to, or truncated. These can be easily identified in the full installation log as those modules with an undef version number:
Checking dependencies from MYMETA.json ...
...
Checking if you have Task::Weaken 0 ... Yes (undef)
...
Checking if you have Devel::GlobalDestruction 0 ... Yes (undef)
Reinstalling the modules Task::Weaken, and Devel::GlobalDestruction should do the trick.

Why do I get many Moose warnings when I start Catalyst?

I am having an issue (Catalyst related) apparently with Moose/Class::MOP. Starting my server I get the following output... (shown below in all its glory)
The alias and excludes options for role application have been renamed -alias and -excludes at /usr/local/lib/perl/5.10.1/Moose/Meta/Role/Application.pm line 26
Moose::Meta::Role::Application::new('Moose::Meta::Role::Application::ToRole', 'excludes', 'ARRAY(0x9645568)') called at /usr/local/lib/perl/5.10.1/Moose/Meta/Role.pm line 416
Moose::Meta::Role::apply('Moose::Meta::Role=HASH(0x95b3368)', 'Moose::Meta::Role=HASH(0x9446d90)', 'excludes', 'ARRAY(0x9645568)') called at /usr/local/lib/perl/5.10.1/Moose/Util.pm line 133
Moose::Util::_apply_all_roles('Moose::Meta::Role=HASH(0x9446d90)', undef, 'MooseX::Getopt', 'HASH(0x9454a08)') called at /usr/local/lib/perl/5.10.1/Moose/Util.pm line 87
Moose::Util::apply_all_roles('Moose::Meta::Role=HASH(0x9446d90)', 'MooseX::Getopt', 'HASH(0x9454a08)') called at /usr/local/lib/perl/5.10.1/Moose/Role.pm line 26
Moose::Role::with('Moose::Meta::Role=HASH(0x9446d90)', 'MooseX::Getopt', 'HASH(0x9454a08)') called at /usr/local/lib/perl/5.10.1/Moose/Exporter.pm line 294
Moose::Role::with('MooseX::Getopt', 'HASH(0x9454a08)') called at /usr/share/perl5/Catalyst/ScriptRole.pm line 8
require Catalyst/ScriptRole.pm called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 113
Class::MOP::__ANON__() called at /usr/share/perl5/Try/Tiny.pm line 71
eval {...} called at /usr/share/perl5/Try/Tiny.pm line 67
Try::Tiny::try('CODE(0x93c2910)', 'Try::Tiny::Catch=REF(0x93bba38)') called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 124
Class::MOP::load_first_existing_class('Catalyst::ScriptRole') called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 136
Class::MOP::load_class('Catalyst::ScriptRole', undef) called at /usr/local/lib/perl/5.10.1/Moose/Util.pm line 109
Moose::Util::_apply_all_roles('Moose::Meta::Class=HASH(0x8fc9378)', undef, 'Catalyst::ScriptRole') called at /usr/local/lib/perl/5.10.1/Moose/Util.pm line 87
Moose::Util::apply_all_roles('Moose::Meta::Class=HASH(0x8fc9378)', 'Catalyst::ScriptRole') called at /usr/local/lib/perl/5.10.1/Moose.pm line 58
Moose::with('Moose::Meta::Class=HASH(0x8fc9378)', 'Catalyst::ScriptRole') called at /usr/local/lib/perl/5.10.1/Moose/Exporter.pm line 294
Moose::with('Catalyst::ScriptRole') called at /usr/share/perl5/Catalyst/Script/Server.pm line 14
require Catalyst/Script/Server.pm called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 113
Class::MOP::__ANON__() called at /usr/share/perl5/Try/Tiny.pm line 71
eval {...} called at /usr/share/perl5/Try/Tiny.pm line 67
Try::Tiny::try('CODE(0x8f6dc38)', 'Try::Tiny::Catch=REF(0x8f8d1c8)') called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 124
Class::MOP::load_first_existing_class('Catalyst::Script::Server') called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 136
Class::MOP::load_class('Catalyst::Script::Server') called at /usr/share/perl5/Catalyst/ScriptRunner.pm line 18
Catalyst::ScriptRunner::run('Catalyst::ScriptRunner', 'Jamaica', 'Server') called at script/boca_server.pl line 8
The old Moose::Util::MetaRole API (before version 0.94) has been deprecated at /usr/local/lib/perl/5.10.1/Moose/Util/MetaRole.pm line 16
Moose::Util::MetaRole::apply_metaclass_roles('for_class', 'Catalyst::Controller', 'metaclass_roles', 'ARRAY(0x97bdff8)', 'method_metaclass_roles', 'ARRAY(0x97ab9f0)', 'wrapped_method_metaclass_roles', 'ARRAY(0x981d650)') called at /usr/share/perl5/MooseX/MethodAttributes.pm line 32
MooseX::MethodAttributes::init_meta('MooseX::MethodAttributes', 'for_class', 'Catalyst::Controller', 'metaclass', undef) called at /usr/local/lib/perl/5.10.1/Moose/Exporter.pm line 355
Moose::Exporter::__ANON__('MooseX::MethodAttributes') called at /usr/share/perl5/Catalyst/Controller.pm line 10
Catalyst::Controller::BEGIN() called at /usr/share/perl5/Catalyst/Controller.pm line 10
eval {...} called at /usr/share/perl5/Catalyst/Controller.pm line 10
require Catalyst/Controller.pm called at /usr/share/perl5/Catalyst.pm line 16
Catalyst::BEGIN() called at /usr/share/perl5/Catalyst/Controller.pm line 10
eval {...} called at /usr/share/perl5/Catalyst/Controller.pm line 10
require Catalyst.pm called at /home/bobek/dev/build_7.2/mvc/Jamaica/script/../lib/Jamaica.pm line 17
Jamaica::BEGIN() called at /usr/share/perl5/Catalyst/Controller.pm line 10
eval {...} called at /usr/share/perl5/Catalyst/Controller.pm line 10
require Jamaica.pm called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 113
Class::MOP::__ANON__() called at /usr/share/perl5/Try/Tiny.pm line 71
eval {...} called at /usr/share/perl5/Try/Tiny.pm line 67
Try::Tiny::try('CODE(0x8fb3230)', 'Try::Tiny::Catch=REF(0x969fee0)') called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 124
Class::MOP::load_first_existing_class('Jamaica') called at /usr/local/lib/perl/5.10.1/Class/MOP.pm line 136
Class::MOP::load_class('Jamaica') called at /usr/share/perl5/Catalyst/ScriptRole.pm line 61
Catalyst::ScriptRole::_run_application('Catalyst::Script::Server=HASH(0x969d748)') called at /usr/share/perl5/Catalyst/Script/Server.pm line 181
Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0x969d748)') called at /usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm line 48
Class::MOP::Method::Wrapped::__ANON__('Catalyst::Script::Server=HASH(0x969d748)') called at /usr/local/lib/perl/5.10.1/Class/MOP/Method/Wrapped.pm line 89
Catalyst::Script::Server::run('Catalyst::Script::Server=HASH(0x969d748)') called at /usr/share/perl5/Catalyst/ScriptRunner.pm line 20
Catalyst::ScriptRunner::run('Catalyst::ScriptRunner', 'Jamaica', 'Server') called at script/boca_server.pl line 8
I am new at Catalyst (and I do like it, I just want to successfully get it up and running). I have checked the latest versions of Moose and Class::MOP and they are up to date (as far as CPAN is concerned).
Hopefully someone familiar with Moose has seen this before. Any suggestions or a place to start checking would be appreciated.
Michelle B.
You're running an old version of Catalyst. This issue has been fixed in commit r13516 and is already available on CPAN as of version 5.80026 (5.80028 is latest and recommended).
Catalyst was using some deprecated feature of Moose, which just recently started warning.
So, you're right, the current Cat stuff has a fairly broken dependency chain. You can see from the current pass/fail on the CPAN for 5.80030 that fails are much higher than normal.
There are several bumps depending on the state of your current modules/versions. This worked for me this morning (I'm not sure if it's overkill)-
cpanm -v namespace::clean
cpanm -v namespace::autoclean
cpanm -v B::Hooks::EndOfScope
cpanm -v Package::Stash
cpanm -v Class::MOP Moose MooseX::Types
cpanm -v MooseX::Role::WithOverloading::Meta::Role::Application
cpanm -v Catalyst Catalyst::Devel
And if you're using Config::General for your configuration, this is a good idea too:
cpanm -v Config::General
If you get those in and it won't start, just read the stack trace (backwards) looking for names or missing functions/methods. Anything you see as a problem, upgrade. It's a "stable" kit but it's a collection of moving targets and everything has to line up.