Commit | Line | Data |
93e0cdbd |
1 | Copyright 1998, O'Reilly & Associates, Inc. |
2 | |
3 | This package may be copied under the same terms as Perl itself. |
4 | |
5 | Disclaimers |
6 | ----------- |
7 | This is a work in progress, and relies on bleeding-edge technology |
8 | from the network. Don't expect not to be surprised occasionally. |
9 | |
10 | Requirements |
11 | ------------ |
12 | Perl 5.005_02 (or later) must be compiled and installed as a shared library |
db4a4bfe |
13 | (libperl.so). I had to use the system's malloc. JPL was originally built |
14 | and tested with 5.004_04 and early Java 1.1 development kits. This version |
15 | has not been well tested under 5.005_02, so you can expect some rough edges. |
93e0cdbd |
16 | |
db4a4bfe |
17 | You need JDK 1.1. On Solaris 1.1.5 has been verified to work. Linux |
18 | users can try the latest version (1.1.3 or later) available from (for |
19 | example): |
93e0cdbd |
20 | |
21 | ftp://ftp.blackdown.org/pub/Linux/JDK/1.1.3/updates/libjava-1.1.3v2-1.tar.gz |
22 | |
23 | The get_jdk directory contains a script that will download JDK (but not |
24 | the patch file above) off of the net for you. (This presumes you've |
25 | already installed the modules mentioned in ../README.) |
26 | |
27 | You may need to ensure that all files under the ../jpl directory are writable. |
28 | install-jpl expects to be run with super-user privileges so that it can |
29 | put things in the right places. |
30 | |
31 | What the heck is JPL? |
32 | --------------------- |
33 | JPL is a hybrid (to use the polite term) language. It's basically Java |
34 | in which the methods can optionally be implemented by Perl code. A |
35 | preprocessor called "JPL::Compile" looks at your .jpl file and spits |
36 | out the appropriate .java, .c, .h, .pl, and .so files to accomplish the |
37 | desired task. Hopefully a lot of those files can go away in the future |
38 | as jpl mutates into a Perl-to-Java compiler. The long-term goal is for |
39 | jpl to be able to take a pure Perl file and spit out a java .class |
40 | file. This initial version of JPL is an attempt to begin to mesh the |
41 | semantics of Java and Perl. Some people may find it useful in its |
42 | current form, but you should know right up front that we've still got a |
43 | ways to go with it. A journey of a thousand miles continues with the |
44 | second step... |
45 | |
46 | JPL Syntax |
47 | ---------- |
48 | JPL syntax is trivial, given that you know Java and Perl. Pretend like |
49 | you're writing a native Java method, but say "perl" instead of |
50 | "native", and then instead of omitting the body of the method, put your |
51 | Perl code in double curlies. (See Sample.jpl for an example.) |
52 | |
53 | Calling back from Perl to Java is done through the JNI (Java Native |
54 | Interface). No weird transmogrifications are done by the preprocessor |
55 | to your Perl code--it's all normal Perl. The preprocessor just wraps |
56 | it up into funny subroutines you don't see unless you peek at the .pl |
57 | file it generates. |
58 | |
59 | Installation |
60 | ------------ |
61 | Run "install-jpl". You have to tell it whether you want to use the |
62 | current directory for JPL_HOME or some other directory. Everything |
63 | else should take care of itself, except that after install-jpl |
64 | writes the setvars program, you are responsible to invoke it properly |
65 | before any JPL applications can be compiled under the current shell. |
66 | |
67 | sh: eval `setvars -sh` |
68 | csh: eval `setvars -csh` |
69 | perl: eval `setvars -perl`; |
70 | |
71 | More Info |
72 | --------- |
73 | |
74 | You can look at the Sample and Test directories, as well as the ../eg |
75 | directory for examples. |
76 | |
77 | Perhaps the most important bit of advice we can give you is to watch |
78 | |
79 | http://perl.oreilly.com |
80 | |
81 | for further information on how to get further information. |
82 | |
83 | Have the appropriate amount of fun. |