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

Discussion in 'Perl Misc' started by http://vmdd.tech.mylinuxisp.com/catalog/, Mar 10, 2005.

  1. 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.
     
    http://vmdd.tech.mylinuxisp.com/catalog/, Mar 10, 2005
    #1
    1. Advertisements

  2. AC

    AC Guest

    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.
     
    AC, Mar 10, 2005
    #2
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VMDD Tech - powered by sockSvr

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

    VMDD Tech - powered by sockSvr, Mar 3, 2005, in forum: Perl
    Replies:
    1
    Views:
    946
    Philip Salgannik
    Mar 4, 2005
  2. Rik Hemsley
    Replies:
    5
    Views:
    5,874
    =?Utf-8?B?Sm9obiBCb3lldHQ=?=
    Apr 1, 2005
  3. VMDD Tech - powered by sockSvr

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

    VMDD Tech - powered by sockSvr, Mar 3, 2005, in forum: Java
    Replies:
    1
    Views:
    458
    Philip Salgannik
    Mar 4, 2005
  4. Replies:
    7
    Views:
    1,175
    Claudio Grondi
    Oct 13, 2005
  5. Replies:
    0
    Views:
    221
Loading...

Share This Page