
December 20th, 2002, 05:10 PM
|
|
Dazed&Confused
|
|
Join Date: Jun 2002
Location: Tempe, AZ
Posts: 91
Time spent in forums: 8 h 34 m 13 sec
Reputation Power: 7
|
|
|
Perl embedded within C
I have a number of Perl scripts spread across oh... 1000 or so servers that are currently being upgraded. Those scripts make database connections hense have somewhat sensitive information. Perl not having any form of compiling, they're sitting there in plain text.
I need to change that.
Now I could go through and re-write them all in C, but to do so would make me want to re-write all the background scripts in C which could take me the next 15 years or so at my current C compentency. So I began searching around for ways of encrypting the scripts while still allowing them to run. Enter the concept of embedding Perl in C.
My goal now is to encode the scripts in some way and run them via a C program. Like so:
- C program loads encoded script into memory
- C program decodes
- C program communicates unencoded script with Perl interpreter
- C and Perl live happily ever-after
Putting the theory into practice, however, is more difficult.
I'm currently toying with the PerlInterpreter that comes in perl.h with the Perl software. The part that I'm getting caught up on is passing the code from memory into the interpretter. I have an array that's capable of holding all the lines of code to push through, but the perl_parse function seems to only imitate the functionatlity of the 'Perl' command line interface... which seems to make the whole thing rather pointless.
In any case, is this at all possible -- be it through PerlInterpreter or some other means?
Any info is greatly appreciated.
Thanks,
Dave Mittner
|