2

I've used the PAR packager (pp) to create a Windows executable foo.exe from a Perl script foo.pl. The Perl script runs fine (perl foo.pl <arguments>). The executable runs, too (foo.exe <arguments>), but doesn't produce the same results as the Perl script. I want to debug the perl script as run by the executable, to figure out where the difference comes from. How do I do that? In other words, how do I pass a -d to the perl.exe that starts when I execute foo.exe?

ADDENDUM 2020-05-26

Using "Process Explorer" I found the application that ends up getting executed. It was %TEMP%\par-<ID1>\cache-<ID2>\foo.exe, where <ID1> and <ID2> are short and long hexadecimal strings. I had hoped to find ...\perl.exe foo.pl instead, then I could have injected my -d into the command line.

Running foo.exe in that folder yields an error "Can't locate PAR.pm in @INC".

That same folder also contains numerous *.pm, *.dll (including perl528.dll), and a few *.pl files, with the *.pl and *.pm files having names that are short hexadecimal strings. One of the *.pl files (the one mentioned in the process's PAR_0 environment variable) turns out to have the same contents as foo.pl, with the following two lines prefixed:

package main;
#line 1 "script/foo.pl"

If I run perl -Iinc/lib <ID>.pl in that folder, with <ID>.pl the name of that perl script, then it produces the desired results, i.e., doesn't run into the problem that the exe runs into. I expect that the perl528.dll and other dlls in that folder are the bits that make up Perl, but don't know how to call them. The foo.exe in that folder is only 78 kB in size, so it cannot do much more than have those other bits do the work.

Louis Strous
  • 942
  • 9
  • 15
  • Unfortunately, it seems it is not possible to pass `-d` option to the `perl.exe`. Maybe try add a request for this feature at [the GitHub issue tracker](https://github.com/rschupp/PAR-Packer/issues)? In any case you could always try debugging by adding `print` statements at selected points in your code.. – Håkon Hægland May 25 '20 at 18:23
  • What is the result you are expecting? Is it some 'print' statement ? Take a look at - https://stackoverflow.com/questions/58817812/win32-strawberry-perl-par-packer-make-exe-file . It's one of common issue. you have to write $| =1 at top. – rai-gaurav May 25 '20 at 20:01
  • @Håkon Hægland: I was hoping to avoid "debugging-by-print". – Louis Strous May 26 '20 at 11:44
  • @Maverick: Your suggestion made no difference, unfortunately. The exe and pl both produce output, but the exe seems to hang while the pl continues producing output and quickly completes. – Louis Strous May 26 '20 at 11:51

0 Answers0