Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi everyone, I have a script called switchscan.pl which is turned into an executable called switchscan through the use of Par Packer. When I run the switchscan, it tries to load the module SwitchScan::Service::local::mlnx, but I end up with this error:

Attempt to reload SwitchScan/Service/local/mlnx.pm aborted (#1) (F) You tried to load a file with use or require that failed to compile once already. Perl will not try to compile this file agai +n unless you delete its entry from %INC. See "require" in perlfunc +and "%INC" in perlvar. Compilation failed in require at script/switchscan.pl line 42 (#2) (F) Perl could not compile a file specified in a require statement +. Perl uses this generic message when none of the errors that it encountered were severe enough to halt compilation immediately. BEGIN failed--compilation aborted at script/switchscan.pl line 42 (#3) (F) An untrapped exception was raised while executing a BEGIN subroutine. Compilation stops immediately and the interpreter is exited. Uncaught exception from user code: Attempt to reload SwitchScan/Service/local/mlnx.pm aborted. Compilation failed in require at script/switchscan.pl line 42. BEGIN failed--compilation aborted at script/switchscan.pl line 42.

How do I get the actual error that caused the compilation failure? When I run perl -c on mlnx.pm before packing everything with Par Packer, I get "syntax OK". Something in the packing process is causing the failure, but I'm at a loss for how to further troubleshoot.

Much appreciated.

  • Comment on Compilation failed in require, but how to get the actual compilation error?
  • Download Code

Replies are listed 'Best First'.
Re: Compilation failed in require, but how to get the actual compilation error?
by dasgar (Priest) on Feb 16, 2018 at 19:14 UTC

    How did you use pp from Par::Packer? (i.e. What options did you use?)

    My initial guess is that you probably need to use -c and/or -x options to "determine additional run-time dependencies". You might even need to -M to tell the pp utility to specifically add in one or more modules.

      Seems to work now, found two missing modules by adding the -c option to pp. Thank you so much.