| 1 | =head1 NAME
|
|---|
| 2 |
|
|---|
| 3 | Tutorial - Perl and Java
|
|---|
| 4 |
|
|---|
| 5 | =head1 SYNOPSIS
|
|---|
| 6 |
|
|---|
| 7 | Java and Perl have different strengths and complement each other well.
|
|---|
| 8 |
|
|---|
| 9 | You can connect them at runtime with tools such as JPL, PJC, or
|
|---|
| 10 | ActiveX. In theory, you can convert Perl to Java bytecode, and
|
|---|
| 11 | vice-versa.
|
|---|
| 12 |
|
|---|
| 13 | =head2 Note:
|
|---|
| 14 |
|
|---|
| 15 | Not actually a conversion.
|
|---|
| 16 |
|
|---|
| 17 | At this stage, we are generating Java opcodes by walking Perl's syntax
|
|---|
| 18 | tree. This is very different from converting Perl to Java. It's a lot
|
|---|
| 19 | easier!
|
|---|
| 20 |
|
|---|
| 21 | =head1 1.1 Perl and Java, Compared
|
|---|
| 22 |
|
|---|
| 23 | Perl offers rich text processing features, high-level network APIs,
|
|---|
| 24 | excellent database integration, and a centralized repository of
|
|---|
| 25 | reusable code:
|
|---|
| 26 |
|
|---|
| 27 | =over 4
|
|---|
| 28 |
|
|---|
| 29 | =item *
|
|---|
| 30 |
|
|---|
| 31 | Regular expression engine is a powerful sub language that can perform
|
|---|
| 32 | complex text manipulations and extract data.
|
|---|
| 33 |
|
|---|
| 34 | =item *
|
|---|
| 35 |
|
|---|
| 36 | Packages such as libwww-perl (LWP) and libnet are powerful, high-level
|
|---|
| 37 | interfaces to network functionality.
|
|---|
| 38 |
|
|---|
| 39 | =item *
|
|---|
| 40 |
|
|---|
| 41 | The Perl DBI is an interface to SQL data sources.
|
|---|
| 42 |
|
|---|
| 43 | =item *
|
|---|
| 44 |
|
|---|
| 45 | CPAN provides a centralized, organized archive of reusable code.
|
|---|
| 46 |
|
|---|
| 47 | =back
|
|---|
| 48 |
|
|---|
| 49 | Java has a powerful graphical API, has numerous embedded
|
|---|
| 50 | implementations, excellent database integration, but no single
|
|---|
| 51 | recognized repository of reusable code.
|
|---|
| 52 |
|
|---|
| 53 | =over 4
|
|---|
| 54 |
|
|---|
| 55 | =item *
|
|---|
| 56 |
|
|---|
|
|---|