in reply to Perl Cross References

The problem seems to be, that the whole B:: module hierarchy is nothing but experimental. Very bad.

That's because the whole B:: module hierarchy is experimental!

I can only wonder though, why you need cross-referencing to get a handle on your project. With a decent design using modern techniques of abstraction and encapsulation, you shouldn't even need it. I can't remember the last time I looked at one, but it must be something like 15 years ago. If I thought I needed one today, I'd be reviewing my design methodologies very carefully.

If you're looking for tools to help dig you out of the mud, and in particular the B:: modules, I'd tend to say that it's already too late.


print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'

Replies are listed 'Best First'.
Re: Re: Perl Cross References
by PetaMem (Priest) on Jun 04, 2002 at 18:11 UTC
    I can only wonder though, why you need cross-referencing to get a handle on your project. With a decent design using modern techniques of abstraction and encapsulation, you shouldn't even need it.

    Oh!

    Well - then probably the best we can do is to tell the B:xxx authors stop wasting their time implementing such useless tools. While it is almost exactly 13 years since I used (and needed) Cross Referencing on some projects of mine, I completedly disagree, that "modern techniques" and discipline and cleverness (I've added that) are enough to carve complex large prototypes flawlessly in perl.

    I had a dispute - long time ago - with a student about the need of some parser-generator for perl. (Was before Parse::RecDescent, perlyacc etc.). He said:

    "You don't need a parser-generator in perl, because you already have regexps. The rest is done in a while-loop."

    Your argument seems pretty same to me.

    Bye
     PetaMem

      Assuming that a bunch of regexps is equivalent to a parser generator is misguided and naïve, I think we both agree on that point.

      But I think you miss my point about cross referencing a Perl program. Cross referencing involves static analysis of source code. For some subset of Perl, this will be fine, but once you start to involve source filters, run-time evaluation of code, closures, ties, autoloading... the problem becomes impossible. Some of the code simply does not exist before the program runs. It is not written, the program writes as it goes along. How can you cross reference that? And the more complex a system becomes, the more likely the above techniques will be employed in order to get a handle on the complexity.

      I'd suggest looking at the Devel:: and Test:: hierarchies, for looking at tools to help you instrument a running program and get feedback on its behaviour, and ensuring its correctness (or at least that you haven't broken anything that used to work when you introduce new code). For instance, I have used chromatic's Devel::TraceMethods to understand a bug in an OO hieararchy that relied heavily on autoloading.

      Honestly, I didn't even know that there was such a thing as B::Xref. I think Malcolm Beattie wrote it more as a proof of concept, rather than expecting people to really use it. Cross referencing just seems so '80s to me.


      print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'
        Cross referencing just seems so '80s to me.

        Now I totally disagree. If you have several ten thousand lines of Perl code in a project. And a well written project I might add (at least as well as real-world circumstances allow). And you want to orient yourself and/or clean up....

        To put it simple: Get more insight to the code

        You will need cross reference.Period.

        It is extremely hard to find anything usable for Perl that actually works. And I must - sorry - scoff on the old argument that Perl code can be generated at runtime and therefore all trials for Xreferencing perl are futile. Yes. So what? If I can solve/cover 95% of all perl code there is!?

        I'm currently seeing two/three alternatives that could prove usable for Perl X-referencing:

        • Hypersrc - a generic source code browser utilizing the exuberant ctags tagging system which has - among many others - support for Perl.
        • The Imenu Tagging system in Emacs
        • The ECB for Emacs
        Hypersrc almost works, somehow it doesn't render functions/methods right and doesn't provide the "is called by" backreference information for methods. But exuberant ctags does a fairly good job, so browsing tagged entities is good.

        Imenu tagging in Emacs works, but gives you only a hierarchy-popup that allows you fast browsing from a set of files down to the method/function level.

        ECB is supposed to be able to utilize the Imenu tagging information and should then work well. Well...

        I hope I will be able to find a *working* X-referencing system for Perl anytime soon, as you simply need it from a certain complexity and volume of your project.

        Bye
         PetaMem
            All Perl:   MT, NLP, NLU