[ANN] j2Perl 2.0 -- Allowing Java to access Perl code

  • Thread starter http://vmdd.tech.mylinuxisp.com/catalog/
  • Start date
H

http://vmdd.tech.mylinuxisp.com/catalog/

Source: http://vmdd.tech.mylinuxisp.co­m/catalog/
(Follow "Java Add-ons" link)


j2Perl 2.0 -- provides the ability to use Perl code in Java. This
implementation is elegant and intuitive. Java is already powerful, but
when combined with Perl, Java becomes turbo-charged.


Usage:
String ret;
j2Perl pl = new j2Perl ("58"); //Load j2perl58.dll which
was linked to
perl58.dll


ret = pl.eval ("mkdir 'h:/aa'");
ret = pl.eval ("mkdir 'h:/aa'; mkdir 'h:/bb';");
ret = pl.eval ("rmdir 'h:/aa'");
ret = pl.eval ("rename 'h:/aa', 'h:/bb'");
ret = pl.eval ("-e 'j2perl.h'"); //Test if the file exists

ret = pl.eval ("-s 't:/a.txt'"); //Returns the file size
in bytes
ret = pl.eval ("-z 'j2perl.h'"); //Test if the file is
empty
ret = pl.eval ("-f 'j2perl.h'"); //Test if the file is a
plain file
ret = pl.eval ("-d 'j2perl.h'"); //Test if the file is a
directory
ret = pl.eval ("-T 't:/a.txt'"); //Test if the file is a
text file
ret = pl.eval ("-B 't:/a.txt'"); //Test if the file is a
binary file
ret = pl.eval ("-M 'h:/jdk-1_5_0-doc.zip'"); //Return age of
the file
(days)
ret = pl.eval ("-A 'h:/jdk-1_5_0-doc.zip'"); //Same for access
time
(days)
ret = pl.eval ("-M 'h:/jdk-1_5_0-doc.zip'"); //Same for inode
change
(days)
ret = pl.eval ("sprintf ('%5d', 12);"); //ret = " 12"
ret = pl.eval ("sprintf ('%5.5d', 12);"); //ret = "00012"
ret = pl.eval ("sprintf ('this prints 2 decimals: %5.2f',
1.23456)"); //ret = "this prints 2 decimals: 1.23";
ret = pl.eval ("time;") //Returns the number of non-leap
seconds since
whatever time the system considers epoch


ret = pl.source ("a.pl"); //Execute a.pl
ret = pl.eval ("unlink 't:/a.txt'"); //Delete the specified
file
ret = pl.eval ("unlink "); //Delete group of files; Return
number of
files deleted
ret = pl.eval ("$_='this will be translated'; tr/tw/TW/; $_");
//ret =
"This Will be TranslaTed";
ret = pl.eval ("gmtime (time)"); //ret = "Wed Mar 2
22:08:34 2005"
ret = pl.eval ("localtime (time)"); //ret = "Wed Mar 2
16:12:28 2005"
ret = pl.eval ("hex '0x12'") //Convert hex to decimal; ret =
"18";


ret = pl.eval ("@arr = (tien, cam, banh)");
ret = pl.eval ("@result = sort @arr"); //ret = "3";
ret = pl.eval ("join (' ', @res)"); //ret = "banh cam tien";


BE AWARE:
If perl code has exception, then Java program will exit. Thus,
make
sure that your perl
code is extremely robust.


TRIAL:
Before downloading j2Perl, please note that j2Perl is free for
personal use. But, businesses,
government agencies, and commercial use require licensing.
Download
now.
 
A

AC

If you expect this to be used for anything but toy programs, you'll have to
do better than having the Java program exit if there is a Perl exception. I
can't image any commercial program that could exist under those conditions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top