Perl 5.8.8 support with Catalyst - perl

Facing below issue when execute catalyst server script.
Couldn't load class (Catalyst::Script::Server) because: "ensure_class_loaded" is not exported by the Catalyst::Utils module
Can't continue after import errors at /opt/madhan/lib/perl5/Catalyst/ScriptRole.pm line 7.
BEGIN failed--compilation aborted at /opt/madhan/lib/perl5/Catalyst/ScriptRole.pm line 7.
Compilation failed in require at /usr/lib/perl5/site_perl/5.8.8/Module/Runtime.pm line 313.
Compilation failed in require at /opt/madhan/lib/perl5/Catalyst/ScriptRunner.pm line 13.
Catalyst::ScriptRunner::find_script_class("Catalyst::ScriptRunner", "testsite", "Server") called at /opt/madhan/lib/perl5/Catalyst/ScriptRunner.pm line 42
Catalyst::ScriptRunner::run("Catalyst::ScriptRunner", "testsite", "Server") called at /opt/madhan/testsite/script/testsite_server.pl line 8
Will the perl 5.8.8 support Catalyst MVC?

This is a bug in Catalyst. There was some type-checking code in Catalyst::ScriptRole (since 2012!) which was completely broken, but the brokenness was only visible in particular circumstances — namely, if a script provided a loader_class to Catalyst::ScriptRole that wasn't already a loaded class (likely no one ever has), or if the system has a very old version of UNIVERSAL.pm such as that shipped with perl 5.8. It's this second case that you're running into.
I've pushed a patch to Catalyst-Runtime to resolve this problem; hopefully it will be released soon it's included in Catalyst-Runtime 5.90115.

Related

Unable to build Perl module Net::MAC::Vendor

I am unable to build Net::MAC::Vendor on a Mac w/ High Sierra. I am relatively new to Perl but have built modules in the past. The error appears to be:
Failed fetching [https://services13.ieee.org/RST/standards-ra-web/rest/assignments/download/?registry=MA-L&format=html&text=14-10-9F] HTTP status []
message [IO::Socket::SSL 2.009+ required for TLS support] at t/fetch_oui_from_custom.t line 21.
Could not fetch data from the IEEE! at t/fetch_oui_from_custom.t line 21.
# Failed test ''Got back array reference' isa 'ARRAY''
# at t/fetch_oui_from_custom.t line 23.
# 'Got back array reference' isn't defined
# Failed test 'Fetched Apple's OUI entry'
# at t/fetch_oui_from_custom.t line 25.
# ''
# doesn't match '(?^:Apple, Inc\.)'
# Looks like you failed 2 tests of 2.
t/fetch_oui_from_custom.t .. 2/?
# Failed test 'fetch'
# at t/fetch_oui_from_custom.t line 27.
Use of uninitialized value in concatenation (.) or string at /Users/johnprokopek/.cpan/build/Net-MAC-Vendor-1.265-13/blib/lib/Net/MAC/Vendor.pm line 320.
Failed fetching [http://standards.ieee.org/cgi-bin/ouisearch?14-10-9F] HTTP status []
Can someone help, thanks
I'm also still on High Sierra (10.13.6), on an ancient-but-still-running Mac Mini mid-2010. Using the built-in /usr/bin/perl (v5.18.2), running install Net::MAC::Vendor inside the CPAN shell gave me the same error. Running force install Net::MAC::Vendor worked, in that the module was installed.
A simple perl -MNet::MAC::Vendor -e "print 'hi'" works, so it looks like Perl can at least load that library, not really sure how to test that it works for real. But, at least this will let you install it and try it.

perl module Class::HPLOO v0.23 install issue #2

Having the exact issue as described at: perl module Class::HPLOO v0.23 install issue, I have attempted to correct the defined(#array) problem by editing to just (#array) and trying to rebuild the module. However I continue to get the return of:
$ make clean
$ perl Makefile.PL
$ make
$ make test: *** No rule to
make target `clean:'. Stop. Manifying 2 pod documents
PERL_DL_NONLAZY=1 "/opt/local/bin/perl5.26" "-Iblib/lib" "-Iblib/arch"
test.pl
1..42
# Running under perl version 5.026002 for darwin
# Current time local: Sun Aug 26 06:48:26 2018
# Current time GMT: Sat Aug 25 22:48:26 2018
# Using Test.pm version 1.26 not ok 1
# Failed test 1 in test.pl at line 9
# test.pl line 9 is: ok(!$#) ; Can't locate object method "new" via package "Foo" at test.pl line 11. make: *** [test_dynamic] Error 2
There are three issues with Class::HPLOO (which as I noted before, hasn't been updated since 2005) that make it fail with modern perls.
As discovered in the previous post,
the obsolete construct defined (#array) is used once in lib/Class/HPLOO.pm' and three times inlib/Class/HPLOO/Base.pm`. This construction has been prohibited since v5.22
The current directory (.) is no longer in #INC (as of v5.24, I think). So the lines in test.pl like
require "test/classtest.pm"
either all need to be rewritten as
require "./test/classtest.pm"
or an easier fix is to put
use lib '.';
at the top of the script.
There is a regular expression in lib/Class/HPLOO.pm, line 1077, with an "unescaped left brace"
$sub =~ s/(\S)( {) (\S)/$1$2\n$FIRST_SUB_IDENT $3/gs ;
{ is a regex metacharacter, and since v5.22 it has been illegal to use it in a context where it is not indicating a quantity. The fix, as the error message suggests, is to escape it.
$sub =~ s/(\S)( \{) (\S)/$1$2\n$FIRST_SUB_IDENT $3/gs ;
Make these three changes to the code you download from CPAN and the module should build on modern Perls. If you're feeling helpful, you can submit a bug report (linking to this post, if you want) or even a patch with an email to bug-Class-HPLOO#rt.cpan.org
come across this issue today, so I fixed it following the answer above. if anyone want to save some time.
I create a repo with the changes. https://github.com/swuecho/Class_HPLOO.git

Is it possible to fatpack script using Log::Log4perl using App::Fatpacker?

I tried to fatpack my Perl script using fatpack utility from the App::Fatpacker module (on CentOS 6.6 64 bit running Perl 5.20). My script uses Log::Log4perl module for logging. fatpack utility complains about logging module:
fatpack trace collect_genomes_to_database.pl
collect_genomes_to_database.pl syntax OK
fatpack packlists-for `cat fatpacker.trace` >packlists
Can't locate object method "new" via package "Log::Log4perl::Appender" at ~/perl5/lib/perl5/Log/Log4perl/Logger.pm line 33.
Compilation failed in require at ~/perl5/lib/perl5/Log/Log4perl/Config.pm line 8.
BEGIN failed--compilation aborted at ~/perl5/lib/perl5/Log/Log4perl/Config.pm line 8.
Compilation failed in require at ~/perl5/lib/perl5/Log/Log4perl/Appender.pm line 9.
BEGIN failed--compilation aborted at ~/perl5/lib/perl5/Log/Log4perl/Appender.pm line 9.
Compilation failed in require at ~/perl5/lib/perl5/App/FatPacker.pm line 149.
BEGIN failed--compilation aborted at ~/perl5/bin/fatpack line 3.
Did someone succeed packing a script containing Log::Log4perl or is not doable?
Can you suggest some other method of making self-containing script?
You've found a bug in Log4perl.
One way around the problem is explicitly loading Log4perl before the rest.
PERL5OPT='-mLog::Log4perl' fatpack ...
This should step around the problem enough to make things work.
Hat Tip to mst and irc.perl.org#toolchain
The docs of App::FatPacker say that support is best provided through #toolchain on irc.perl.org. I took the liberty to share the question there.
Following is a log of the conversation with irrelevant stuff removed.
[16:02:15] <simbabque> mst: interesting question on fatpacker Is it possible to fatpack script using Log::Log4perl using App::Fatpacker?
[16:15:47] <mst> simbabque: not really, the user didn't use their brain and Mithaldu already solved the problem :)
[16:15:47] <Mithaldu> \o/
[16:16:08] <Mithaldu> main problem: user is using an old perl that doesn't tell them to load the module
[16:16:50] <mst> hm, actually, that appears to be the packlists-for command
[16:16:51] <mst> simbabque: wait
[16:16:53] <mst> fuck me running
[16:17:14] <mst> this may be an l4p bug
[16:17:31] <mst> simbabque: ooooh
[16:18:02] <mst> I think
[16:18:24] <mst> Log::Log4perl::Appender is loading ::Config which is loading ::Logger ... which is then trying to ->new on ::Appender before the method's been defined yet
[16:18:49] <mst> hence why packlists-for is blowing up trying to require modules
[16:19:29] <Mithaldu> that sounds various kinds of un fun
[16:21:00] <mst> or he's missed a chunk of error
[16:21:23] <simbabque> that he's missing something sounds likely
[16:21:28] <mst> ah, no, it is doing a require, I am right, and L4p is fucked
[16:21:32] <mst> 149 is 'require $t;'
[16:21:42] <mst> it's a circular require problem in l4p
[16:22:57] <Mithaldu> so he's gonna have to %INC munge?
[16:24:25] <mst> or somebody should hit MSCHILLI with a stick and get it fixed
[16:27:13] <mst> BINGO
[16:27:17] <mst> perl -e 'use Log::Log4perl::Appender;'
[16:27:19] <mst> BOOM
[16:30:15] <mst> https://github.com/mschilli/log4perl/issues/59
[16:30:16] <dipsy> [ Circular require causes explosion · Issue #59 · mschilli/log4perl · GitHub ]
[16:30:22] <mst> can somebody shove that onto SO please
[16:30:35] <Mithaldu> sure
[16:33:44] <kentnl> I imagined you could work around that by avoiding the problem module in packlists-for and copying it manually, after the "Tree" stage. But I haven't done a lot here.
[16:34:11] <mst> PERL5OPT='-mLog::Log4perl' fatpack ...
[16:34:13] -*- ether sees riche has already left :/
[16:34:14] <mst> would probably work
[16:34:26] <mst> yep
As Kent Fredric already posted, a workaround is to
$ PERL5OPT='-mLog::Log4perl' fatpack collect_genomes_to_database.pl
... but he was faster in posting it.
And that is the Perl Community at work. :)

Perl module broke my windows xampp installation

PROBLEM: In the process of trying to install gitstat on a Windows7 machine I broke my xampp Apache installation. Now I can't get gitstat or apache to work.
APACHE ERROR:
[error] Can't load Perl file: C:/xampp/apache/conf/extra/startup.pl for server localhost:80, exiting...`
Other people have reported this issue being caused by the PERL5LIB environment variable, but that variable does not exist on my machine.
WHAT I DID / GITSTAT ERROR:
I needed the SOAP::Lite module installed so I followed the windows guide here: http://soaplite.com/install.html
As far as I could tell I installed the module successfully, console output below
cpan[1]> install SOAP::Lite
CPAN: Storable loaded ok (v2.21)
Going to read '\xampp\perl\bin\.cpan\Metadata'
Database was generated on Wed, 27 Jun 2012 02:47:03 GMT
SOAP::Lite is up to date (0.714).
I saw a SOAP directory in perl/site/lib which (to me) means that the module should be available. When I look in my perllocal.pod file SOAP:Lite is in there.
Part of the gitstat installation instructions say to copy the Lite.pm file from perl/site/lib/SOAP into gitstat\gstat_pl\lib
However, when I try to perform step nine of gitstat installation (perl gitstat.pl HEAD) I get the following:
C:\xampp\htdocs\gitstat\gstat_pl>perl gitstat.pl HEAD
Supported versions:
BEGIN failed--compilation aborted at C:/xampp/perl/site/lib/SOAP/Lite.pm line 34
86.
Compilation failed in require at C:/xampp/perl/site/lib/SOAP/Constants.pm line 1
3.
BEGIN failed--compilation aborted at C:/xampp/perl/site/lib/SOAP/Constants.pm li
ne 13.
Compilation failed in require at lib/Lite.pm line 3444.
BEGIN failed--compilation aborted at lib/Lite.pm line 3444.
Compilation failed in require at gitstat.pl line 30.
If I don't copy the file from perl/site/lib/SOAP then I get
C:\xampp\htdocs\gitstat\gstat_pl>perl gitstat.pl HEAD
Can't locate lib/Lite.pm in #INC (#INC contains: C:/xampp/perl/lib C:/xampp/perl
/site/lib .) at gitstat.pl line 30.
I don't understand why CPAN didn't install the Lite.pm module in the #INC path or why the compilation might fail when the module is available, or most importantly why my Apache install is broken. Also I'm very new to Perl and CPAN and my understanding of Apache is primitive so simpler explanations would be greatly appreciated.

Perl XS included from a “use lib” directory can’t be found by ISAPI

I have a Perl web application that runs on both Apache and IIS6 on Windows Server 2003. On Apache this script works just fine. In IIS using ISAPI, I am getting the following error message:
Software error:
Can't load
'lib/auto/Sub/Name/Name.dll' for
module Sub::Name: load_file:The
specified module could not be found at
C:/Perl/lib/DynaLoader.pm line 230.
at lib/DBIx/Class/Schema.pm line 10
Compilation failed in require at
lib/DBIx/Class/Schema.pm line 10.
BEGIN failed--compilation aborted at
lib/DBIx/Class/Schema.pm line 10.
Compilation failed in require at (eval
39) line 3. ...propagated at
C:/Perl/lib/CGI/Carp.pm line 314.
BEGIN failed--compilation aborted at
My/Schema.pm line 2. Compilation
failed in require at...
When NOT using ISAPI in IIS it runs fine. We would prefer to continue using ISAPI in our IIS environments. Why can't it find this module, even though it does when running normal Perl?
EDIT:
We were calling it with relative paths.
use lib qw{My lib}; # line in question
use My::Schema; # explodes
Mobrule, your comment enlightened us. The relative path was different between using the vanilla Perl interpreter and ISAPI.
use lib qw{My /Inetpub/wwwroot/cgi/lib}; # a little more specific...
use My::Schema; # not nearly as much dying now.
Thanks for the help!