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

I tried to degrease my Perl script using the fatpack utility from the App :: Fatpacker module (on CentOS 6.6 with Perl 5.20 64-bit). My script uses the Log :: Log4perl module for logging. the fatpack utility complains about the registration 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.

      

Has anyone managed to package a script containing Log :: Log4perl or is it not doable?

Can you suggest another method for creating a self-contained script?

+3


source to share


2 answers


The docs from App :: FatPacker say that support is best provided through #toolchain

irc.perl.org. I took the liberty of sharing this question.

The following is a conversation log with unnecessary deleted material.

[16:02:15] <simbabque> mst: interesting question about fatpacker Is it possible to use a fatpack script with Log :: Log4perl using App :: Fatpacker?
[16:15:47] & mst> simbabque: not really, the user didn't use his brain, and Mithaldu has already solved the problem :)
[16:15:47] <Mithaldu> \ o /
[16:16:08] <Mithaldu > Main problem: the user is using an old perl that does not tell them to load the module
[16:16:50] <mst> hm, in fact, it seems to be the packlists command - for the command
[16:16:51] < mst> simbabque: wait
[16:16:53] <mst> fuck me running [16:17:14] <mst> it might be l4p error
[16:17:31] <mst> simbabque: ooooh
[16:18:02] <mst> I guess [16:18:24] <mst> Log :: Log4perl :: Appender is loaded :: Config which is loaded :: Logger ... which then tries -> new on :: Appender before the method is defined yet
[16:18:49] <mst> hence why packlists-for explodes trying to require modules
[16:19:29] <Mithaldu> which sounds like a different pleasure [16:21 : 00] <mst> or he missed a chunk of error
[16:21:23] <simbabque> that he missed something that seems likely [16:21:28] <mst> ah, no, he demands, I right and L4p fucks
[16:21:32] <mst> 149 'requires $ t;'
[16:21:42] <mst> this circular task requires in l4p
[16:22:57] <Mithaldu>, so it will need% INC munge?
[16:24:25] <mst> or someone has to hit MSCHILLI with a stick and fix it

[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 requires occurrence explosion ยท Issue # 59 ยท mschilli / log4perl ยท GitHub]
[16:30:22] <mst> can someone push this to SO please [16:30:35] <Mithaldu> sure
[16:33:44] <kentnl> I assumed that you can work around this by avoiding the problematic module in packages and manually copying it after the Tree step. But I haven't done much here.
[16:34:11] <mst> PERL5OPT = '- mLog ::Log4perl 'fatpack ...
[16:34:13] - * - the ether sees that the rishis have already left: /
[16:34:14] <mst> will probably work [16:34:26] <mst> yep

As Kent Fredrick already wrote, the workaround is



$ PERL5OPT='-mLog::Log4perl' fatpack collect_genomes_to_database.pl

      

... but he wrote it down faster.


And that's the Perl community at work. :)

+4


source


You have encountered an error in Log4perl .

One way of the problem is explicitly loading Log4perl before the others.

PERL5OPT='-mLog::Log4perl' fatpack ...

      



This should fix the problem enough for everything to work.

Hat tip mst

andirc.perl.org#toolchain

+4


source







All Articles