In a nutshell
PXPerlWrap is a Perl wrapper. That is, it enables you embedding Perl in your C++ (MFC, but STL port planned) application, with minimum efforts. Enjoy the power of Perl through an intuitive set of C++ classes. Embed a world widely used scripting language without efforts: enjoy the power of Perl in minutes. Write high quality applications in seconds. Maintain them as easily. Enrich your applications of a scripting ability, extending to the infinity the possibilities for your end-users.
Special features: MT-safe object architecture, Persistent interpreters, transparent variables modification, UTF8 conversion options, Unicode support.
Features:
PXPerlWrap is a bi-directional wrapper. That is:
- you can execute Perl code from your MFC application, and manipulate variables etc.
- you can call your application, C++ functions and classes from within your Perl scripts.
The first direction is achieved by PXPerlWrap. The second direction is achieved by SWIG, a free wrapper to several languages, on which you can find information here.
PXPerWrap is a namespace containing an intuitive set of classes, multithread-safe:
CPerlInterpreter: represents a Perl interpreter, persistent. Several different interpreters can be loaded.
- parse scripts;
- run scripts, several times;
- get a variable object to manipulate it or simply retrieve its value(s);
eval a piece of Perl quickly.
CScript: a script object. Each script keeps record of its own properties towards each interpreter.
- load a plain text script;
- load it from various sources: inline, file, URL, resource;
- save it to file;
- compile a plain script into byte code;
- test a script;
- reformat a script;
- set its
ARGV.
CPerlScalar: interfaces a Perl scalar variable.
- string, integer, float assignment and arithmetic operations, as simple as
s = "hello", s /= 1 and s += 1.0f, the way Perl supports it.
split it into a CPerlArray;
- deal with UTF8 manually.
CPerlArray: interfaces a Perl array variable.
- common
CStringArray operations;
push, unshift, unshift in reverse order, push in reverse order, either a CPerlArray object, a CStringArray, or several elements from vararg;
join it into a CPerlScalar.
CPerlHash: interfaces a Perl hash variable.
- common
CMapStringToString operations;
- Perl's
each, keys, and values.
- The
stdout and stderr standard streams can be redirected and sent to a window.
PXPerlWrap supports UTF8 Perl encoded strings and offers various strategies in Unicode builds towards automatic strings conversion.
- Advanced error management
- ...
You said persistent interpreter?
The idea of the persistent interpreter was found in perlembed. It consists of parsing once a script which will take care of parsing and running itself other scripts. Each scripts are assigned a different package name. This way, cleaning the package associated with a script will clean the variables used by the script, and free the memory associated with them.
Benefits of persistent interpreters:
- if a module is used by several scripts, you can choose to load it once and it will affect all scripts. This prevent having to load a module each time a script is parsed. This can be a huge perfomance gain, if you consider theloading time of some modules.
- you can clean a script (the script namespace: variables etc.), hence freeing memory for other scripts,
- safety: die and exit won't make your application actually exit :) Besides, PXPerlWrap has an advanced error report and logging system.
You should also have a look at the API documentation for a comprehensive listing of available functions and classes. Platforms supported:
Windows NT, Windows XP, Windows Server 2003
|