in reply to Convertion Perl Script to Exe with PAR::Packer pp

Email::Sender::Simple uses MooX::Types::MooseLike::Base, which uses Moo, which uses Module::Runtime. So pp is simply telling you that your script might use extra modules it cannot know about. (Indeed, cannot know about; I'm quite sure that determining precisely which modules a script uses in the presence of modules loaded at runtime without actually running the script and exercising all possible code paths would be equivalent to solving the halting problem.)

  • Comment on Re: Convertion Perl Script to Exe with PAR::Packer pp

Replies are listed 'Best First'.
Re^2: Convertion Perl Script to Exe with PAR::Packer pp
by RonW (Parson) on Jul 24, 2014 at 23:21 UTC

    As long as a module or library doesn't "compute" what else it needs to load at run time, it is possible to statically inspect each module and library loaded to find what they load. Then scan all those and so on, until you run out of "new" modules and libraries.

    As I understand it, the scanner used by PAR::Packer only scans Perl modules. If the libraries loaded by any of these modules load further libraries (and maybe even modules), it won't see them. So, pp has the -c and -x options to help.

    -c tells it to compile the input. This runs each module's setup code, as well as any BEGIN, UNITCHECK and CHECK blocks (see BEGIN). This updates information in the Perl environment that the scanner can inspect for more libraries and modules.

    -x actually runs the inputs, but without parameters or options1. This might find even more then -c, but some programs might not work properly when run this way.

    YMMV applies.

    1 In the past, I've had problems with programs that, correctly, exit with a non-zero status when run with no parameters or options. I and others have requested either a way to specify parameters/options or to otherwise detect when being run by the PAR::Packer scanner. Maybe this will happen.

    Update: Or to add an option to ignore the program's exit status.

    In the meantime, possible work-arounds include do a test run with a modified version of your program, or "enhance" your program to check for a value in an environment variable you set before running pp/PAR::Packer (actually, the ability to accept options through an environment variable may, in some cases, be a desirable feature)

      Thanks, executing with -x resolved this problem but my script access the xlsx file so when i run the exe file generated by pp i have the error:

      Iniciando o envio de e-mails... IO error: opening script\jofalista.xlsx for read : No such file or dir +ectory at C:/strawberry/perl/vendor/lib/PAR.pm line 636. Cannot open script\jofalista.xlsx as Zip archive at Spreadsheet/XLSX.p +m line 33.
      note: while pp is converting the program works fine, the problem happens when i'm execute de file exe.

        Did you maybe forget to package the XLSX file as an additional file?

        Maybe now is a good moment to read the pp manpage?