matth has asked for the wisdom of the Perl Monks concerning the following question:

Is there software that can undertake reverse engineering of Perl OO scripts. Reverse engineering is where language code can be converted to object schemas. I have seen software like this for Java and C++ (although not used these features). If there isn't software that can do this for Perl, I would like to ask why. Is it simply because of the way the language works.

Replies are listed 'Best First'.
Re: Reverse engineering
by gjb (Vicar) on Jan 31, 2003 at 14:33 UTC

    It'd be very hard for Perl since it is weakly typed. Suppose an object is implemented using a hash, how can you determine the type of the attributes? Similarly, what are the arguments to a method?

    Another point: methods can parse their arguments using shift(@_) or by filling a local hash, again it's almost impossible to figure out what's going on automatically.

    Just my 2 cents, -gjb-

Re: Reverse engineering
by Heidegger (Hermit) on Jan 31, 2003 at 14:31 UTC

    This question has been asked before.

    Check the Q&A answer about UML diagrams here.

    Perl isn't as advanced on OO modelling as C++/Java are, which have dozens of tools. Once I wanted to try the AutoDia tool under Windows and couldn't install it. If I'll have to draw class diagrams for my Perl code, I think I'll just take a regular UML modelling tool and draw diagrams by hand.

      Could you provide your links to other stuff on Perl Monks not with <a href="">this</a> but with [id://167834|that] or even just [167834|that].

      Your way doesn't work for monks that use, as you loose your logged-in status when switching from .com to .org.

      -- Hofmator

Re: Reverse engineering
by Heidegger (Hermit) on Jan 31, 2003 at 14:34 UTC
    Strongly typed languages like C++ and Java went very far with OO diagram modelling. The next hype with OO is refactoring and there are already automatic tools for these languages. It's a pity, but Perl is still behind with refactoring too.