monks,
The issues with embedding perl, distibuting perl apps without a perl install, perl runtime environments, perl plugins etc etc are well-covered here at the monastery.
I am not a C programmer and do not enjoy compiling code-bases like Perl, but as a perl coder the idea of embedding is appealing to me. PAR fulfills this to a certain extent, but real easy embedding could do a lot more than just application packaging.
As a proof-of-concept, I took the minimal C i knew and hacked together a surprisingly small .h file that can be used to link up to a precompiled perl library - perl58.dll or libperl.so.
The code in its current state is trivial and limited, but it has been tested on Mandrake 9.1 and Windows and works AOK running a fairly large, pure-perl web-app from the command line.
I would appreciate any opinions from the real C coders amongst us on the viability and limits of this approach, and whether this is worth pursuing further. Of course ideas/improvements from anyone are welcome.
edit: removed link to tarball, see below for the basic gist
cheers
The issues with embedding perl, distibuting perl apps without a perl install, perl runtime environments, perl plugins etc etc are well-covered here at the monastery.
I am not a C programmer and do not enjoy compiling code-bases like Perl, but as a perl coder the idea of embedding is appealing to me. PAR fulfills this to a certain extent, but real easy embedding could do a lot more than just application packaging.
As a proof-of-concept, I took the minimal C i knew and hacked together a surprisingly small .h file that can be used to link up to a precompiled perl library - perl58.dll or libperl.so.
The code in its current state is trivial and limited, but it has been tested on Mandrake 9.1 and Windows and works AOK running a fairly large, pure-perl web-app from the command line.
Thats the API as it stands now, effectively miniperlmain.c with cross-platform library loading...#include "perlembed.h" int main(int argc, char** argv, char** env) { perlembed_setup("perl58.dll"); perlembed_run(argc, argv, env); perlembed_teardown(); return 0; }
I would appreciate any opinions from the real C coders amongst us on the viability and limits of this approach, and whether this is worth pursuing further. Of course ideas/improvements from anyone are welcome.
edit: removed link to tarball, see below for the basic gist
cheers
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: poor mans embedding
by BUU (Prior) on May 25, 2004 at 22:22 UTC | |
by Ctrl-z (Friar) on May 26, 2004 at 00:12 UTC | |
Re: poor mans embedding
by Ctrl-z (Friar) on May 31, 2004 at 11:15 UTC |
Back to
Meditations