Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: Convertion Perl Script to Exe with PAR::Packer pp

by RonW (Parson)
on Jul 24, 2014 at 23:21 UTC ( [id://1094968]=note: print w/replies, xml ) Need Help??


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

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)

Replies are listed 'Best First'.
Re^3: Convertion Perl Script to Exe with PAR::Packer pp
by marchiore (Initiate) on Jul 25, 2014 at 12:09 UTC

    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?

        i have tried
        pp -x -o -a "jofalista.xlsx" gmail_att.pl
        but without success. If i package the file with -a can i change the xlsx after the compilation?? UPDATE: it works when i change in the script "__FILE__" to "$0" but i can't change the information in the xlsx. is it possible?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1094968]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-20 00:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found