D.10 Embeddible, ExtensibleThe guts of Perl is defined well enough that it becomes a relatively straightforward task to embed the Perl compiler/interpreter inside another application, or to extend Perl by connecting it with arbitrary code written in C/C++ (or having a C-like interface). In fact, about a third of the on-line documentation for Perl is specifically devoted to embedding and extending Perl. The perlembed , perlapi , perlxs , perlxstut , perlguts , and perlcall documenation pages cover these topics in depth. And because Perl is freely reusable, you can write your proprietary spreadsheet application, using an embedded Perl to evaluate the expressions in your spreadsheet cells, and not have to pay one cent in royalties for all that power. Joy. D.10.1 Security Matters
Perl was designed with security in mind. See
Chapter 6
of
Programming Perl
or the
perlsec
documentation about taint checking. This is the kind of security where you trust the writer of the program, but not the person running it, such as is often the case with server-launched programs. The D.10.2 Switch or Case StatementsNo, Perl doesn't really have these statements, but you can easily make them by using more basic constructs. See Chapter 2 of Programming Perl or the perlsyn documentation. D.10.3 Direct I/O: sysopen, sysread, syswrite, and sysseekSometimes Perl's high-level I/O is a bit too high-level for what you need to do. Chapter 3 of Programming Perl and the perlfunc documentation cover direct access to the raw system calls for I/O. D.10.4 The Perl CompilerAlthough we speak of Perl as compiling your code before executing it, this compiled form is not native object code. Malcolm Beatie's Perl compiler project can produce standalone byte code or compilable C code out of your Perl script. The 5.005 release of Perl is expected to have native code generation included as part of the standard release. See the material in the perlfaq3 documentation about this. D.10.5 Database SupportYes, Perl can interface directly with your commercial database servers, including Oracle, Sybase, Informix, and ODBC, just to name a few. See the database section in the CPAN modules directory for the relevant extension modules. D.10.6 Complex Data StructuresUsing references, you can build data structures of arbitrary complexity. These are discussed in Chapter 4 of Programming Perl , and in the perllol , perldsc , and perlref documentation. If you prefer an object-oriented data structure, see Chapter 5 of Programming Perl , or the perltoot and perlobj documentation. D.10.7 Function Pointers
Perl can store and pass pointers to functions via the |
|