Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Using Perl subroutines in a Perl2Exe exe file

by hydo (Monk)
on Jun 30, 2005 at 05:41 UTC ( #471225=note: print w/replies, xml ) Need Help??

in reply to Using Perl subroutines in a Perl2Exe exe file

You might consider using PAR to build your executable. It would solve the problem with including IPC::Run as it does a very good job of scanning dependencies and including them in the exe. You would still have to figure out a way to obfuscate though.

Still, it's one problem potentially solved.


But, when I turn into bar.exe, how then can I call bar's subroutines (passing multiple input values and receiving multiple return values)?

Using PAR will let you build the exe off of PAR will recursively scan your script and all of the dependent modules, including your file, and bundle them up.

Unless I'm completely missing something funky that you are trying to do, if it works when run from the script, ie "perl ./" it will work in PAR with a simple "pp -o foo.exe"

  • Comment on Re: Using Perl subroutines in a Perl2Exe exe file

Replies are listed 'Best First'.
Re^2: Using Perl subroutines in a Perl2Exe exe file
by hydo (Monk) on Jun 30, 2005 at 05:49 UTC
Re^2: Using Perl subroutines in a Perl2Exe exe file
by Anonymous Monk on Jun 30, 2005 at 19:21 UTC
    Great stuff! Thanks VERY much! I used PAR's pp program to build an .exe, and this .exe (unlike the ones produced by Perl2Exe and PerlApp) worked great on my development system!

    But then, I copied this .exe to another system (one without Perl) and ran it. It died, with:

    : Win32::Process::Create() at IPC/ line 2097
    : Win32::Process::Create() at IPC/ line 2216
    : Win32::Process::Create() at IPC/ line 2216

    A Perl guru in another place had told me that this indicates IPC::Run-spawned processes could not locate Perl at run time; he directed me to add:

    # BEGIN { $^X = 'C:\Perl\bin\perl.exe' }

    to my program. This worked, as long as there was a perl.exe file at that location. Since my 'other' system does not have any Perl installed, that file didn't exist.

    I guess I had ASSumed that PAR/pp provided Perl. Not so? If not, can I just bundle perl.exe into my .exe file, and have it work?


      I don't have a PC to test it on at the moment, so I can't tell you exactly where it is, but I do know two things:

      1. There *is* a copy of the interpreter bundled by default in PAR exe files.

      2. You can create your PAR exe, then unzip it with whatever you use for .zip files, and look at the directory structure. As I understand it, and hopefully someone will correct me if I'm wrong, the cwd when the .exe file is running will the the top level of that directory structure. You should then be able to modify that BEGIN line with the relative path of the interpreter and make it work. Well, that and taking out the "#" that's making it a comment. :)

      Again, I can't test this but I think it should work or at least put you on the path to.... errmm.... workitude?

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (1)
As of 2023-09-28 00:19 GMT
Find Nodes?
    Voting Booth?

    No recent polls found