in reply to Concealing Perl Code

I saw a method of doing this awhile ago where the code was wrapped into c binary. It only prevented novices
from viewing the code, since all you needed to do was open the binary file and browse through it.


i have a snippet from one of my chat logs ...
/*#define MULTIPLICITY */ /* try not to be a bad boy, avoid tinkering +with the interpreter's internal structure! */ \#include <EXTERN.h> \#include <perl.h> \#include <stdlib.h> static PerlInterpreter *pi; static char *script = $scriptText; int main(int argc, char **argv, char **envv) { int l, i, p_argc; char **p_argv; char *e_switch = \"-e\"; char *real_name = argv[0]; char *s_argv[2] = { e_switch, script } ; char **p_envv = envv; p_argc = argc+2; p_argv = (char **)malloc(sizeof(char*)*argc); p_argv[0] = argv[0]; p_argv[1] = s_argv[0]; p_argv[2] = s_argv[1]; for(i=1;i<argc;i++) { p_argv[i+2]=argv[i]; } pi = perl_alloc(); perl_construct(pi); perl_parse(pi,NULL,p_argc,p_argv,p_envv); { SV *sv; sv = perl_get_sv(\"0\",FALSE); if (!SvOK(sv)) { printf(\"%s: unrecoverable error\\n\",argv[0]); exit(EXIT_FAILURE); } sv_setpv(sv,argv[0]); } perl_run(pi); perl_destruct(pi); perl_free(pi); return EXIT_SUCCESS; }
I wish i could remember what it was called or who wrote it.
I'll try and find it on my old disks