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

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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.

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

        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
        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
        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
        ret = pl.eval ("-A 'h:/jdk-1_5_0-doc.zip'");  //Same for access
        ret = pl.eval ("-M 'h:/jdk-1_5_0-doc.zip'");  //Same for inode
        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
        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 =

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

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

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

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

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.

Site Timeline