Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Using Perl subroutines in a Perl2Exe exe file

by Xaositect (Friar)
on Jun 29, 2005 at 19:32 UTC ( #471148=note: print w/replies, xml ) Need Help??


in reply to Using Perl subroutines in a Perl2Exe exe file

I haven't used Perl2Exe, but I suspect this won't be possible. bar.pm as you describe it is intended to be a resource, whereas bar.exe would be a program.

The only way to accomplish this that I could think of would be to write another script that uses Bar.pm, and provides a command-line interface so you could perl2exe the new script, and make system calls with command-line arguments in foo.pl.

Frankly, I'd suspect that perl2exe won't provide much code protection anyway. Many of these 'create an exe out of a scripting language' programs just give you back an executable perl interpreter that's designed to look inside it's own file for the perl code to execute. (which means that anyone with an editor can open the exe, page through the binary garbage, and find your code at the end) If your desire is simply to protect your source, you'll be better off finding a tool specifically for that.


Xaositect - Whitepages.com
  • 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 tlemons (Novice) on Jun 29, 2005 at 20:15 UTC
    Wow, thanks very much for this reply! Much to chew on.

    First, I ran Perl2Exe on my code, and then fired up Wordpad to look at the file. Happily, I didn't see anything that looked like Perl source code. And, when I searched for the one text string that I want to protect, I didn't find it. So, while this is probably not encrypted in the classic sense, it seems sufficiently obscured that it meets my need.

    I like your idea of writing a 'glue' script that would provide a CLI interface. I can see how to pass paramters into this (just by putting them on the command line following the name of the glue script .exe file). But how can I receive multiple return values back (or can I)?

    Thanks
    tl

      Aww shucks, that adds at least 30 seconds to the time it takes to look at your plaintext perl script... Look here


      -Waswas

      Well, you can only get the exe's return value if you are expecting a single integer back from the call.

      my $returncode = system('bar.exe some params');
      I think there are some rather harsh range limitations on the return code as well. That's probably not going to be good enough, so you're probably going to have to develop a common interface of some kind. The easiest would be to simply print to stdout, but it could be anything, like creating a file, or inserting into a database, or whatever.
      my $stdout = qx("bar.exe some arguments");
      Watch out for the fact that command-line arguments are processed differently depending on how many arguments you pass to the system or qx call.


      Xaositect - Whitepages.com

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2018-11-19 01:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (206 votes). Check out past polls.

    Notices?