perl-parser? or a perl 2 java converter?

Discussion in 'Perl Misc' started by Guest, Oct 12, 2004.

  1. Guest

    Guest Guest

    Hello!

    i have prototyped some applications in perl, and now want to rewrite
    them in java...

    rewriting from scratch would be quite some work, thus i am looking if
    there are some ready means to convert the perl code (as far as possible)
    into java code...

    google idn't manage to find me anything on this....

    alternatively, is there a way to instruct the perl parser to issue the
    parsed perl-tree before execution?

    or if even this isn't possible, the reflection possibilities in perl
    seem a bit limited, is there a way to ask a an instance of an object the
    list of implemented methods, and possibly only the methods overwritten
    in the current class?
    --
    bboett at inforezo dot u-strasbg dot fr
    http://inforezo.u-strasbg.fr/~bboett
    ==============================================================
    Unsolicited commercial email is NOT welcome at this email address
    Guest, Oct 12, 2004
    #1
    1. Advertising

  2. Guest

    Ben Morrow Guest

    Quoth :
    >
    > i have prototyped some applications in perl, and now want to rewrite
    > them in java...
    >
    > rewriting from scratch would be quite some work, thus i am looking if
    > there are some ready means to convert the perl code (as far as possible)
    > into java code...


    AFAIK there aren't any. Perl->* convertors are provided by the O and
    B::* modules, but the ones such as B::C and B::CC that actually produce
    working programs in other languages have pretty much all been put on
    hold, and it's not recommended you use them any more as they were never
    properly finished.

    You could always write one, of course :)

    > alternatively, is there a way to instruct the perl parser to issue the
    > parsed perl-tree before execution?


    You could try B::Concise, but I really don't know what you think you
    might do with the information.

    > or if even this isn't possible, the reflection possibilities in perl
    > seem a bit limited,


    <standard answer for any advanced OO in perl5>
    Yes, they are; this will be fixed (with a vengeance) in perl6, but don't
    hold your breath.

    > is there a way to ask a an instance of an object the
    > list of implemented methods, and possibly only the methods overwritten
    > in the current class?


    Not in general. You could walk the namespace and get all the defined
    subs with something like

    no strict 'refs';
    $\ = "\n";
    my $class = 'My::Class';
    for my $i (keys %{"$class\::"}) {
    print $i if exists &{"$class\::$i"};
    }

    but this

    1. won't distingish methods from functions

    2. won't distinguish public/private methods (the concept doesn't exist
    in Perl)

    3. won't find inherited methods (though you could check @ISA and
    recursively walk those classes as well)

    4. most importantly, won't find AUTOLOADed methods unless they've been
    stubbed, which is usual for AUTOLOADed functions but not for methods as
    you don't need to.

    Ben

    --
    For the last month, a large number of PSNs in the Arpa[Inter-]net have been
    reporting symptoms of congestion ... These reports have been accompanied by an
    increasing number of user complaints ... As of June,... the Arpanet contained
    47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] *
    Ben Morrow, Oct 12, 2004
    #2
    1. Advertising

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. Alan Connor

    [OT] Perl to C Converter?

    Alan Connor, Aug 22, 2004, in forum: Perl
    Replies:
    27
    Views:
    15,010
    Jürgen Exner
    Aug 24, 2004
  2. TomasH
    Replies:
    2
    Views:
    6,282
    La'ie Techie
    Oct 15, 2003
  3. mm
    Replies:
    10
    Views:
    2,481
    Uwe Grauer
    Jan 5, 2007
  4. Alan Connor

    [OT] Perl to C Converter?

    Alan Connor, Aug 22, 2004, in forum: C Programming
    Replies:
    32
    Views:
    855
    Jürgen Exner
    Aug 24, 2004
  5. Vinod Kone
    Replies:
    7
    Views:
    170
    Logan Capaldo
    Jan 22, 2007
Loading...

Share This Page