Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

claes (1758)

claes
  (email not shown publicly)
http://www.surfar.nu/
AOL IM: claesjacobsson@mac.com (Add Buddy, Send Message)

Journal of claes (1758)

Monday August 18, 2003
08:25 AM

cross reference of entire CPAN

[ #14181 ]
A couple of weeks ago I spent some time in London after YAPC::Europe. At an emergency london.pm social meeting we had a few drinks and then Sky started handing out projects to us who had nothing to do.

I got assigned the fun task of cross-referencing CPAN!

Basiclly, it analyses source code - finding what other packages it uses or requires, what subroutines it declares, what functions and methods it calls and what packages it defines. From this information a database is built holding references.

In the web-interface, you can browse the distribution and if a file is indexed you can have a look at the source. When it lists the source, each connection (like a use, call etc) are linked and if you click that link you'll end up in the symbol page. This is where it's getting interesting. The symbol display page shows in what file(s) the symbol is define as a package, declared as a subroutine or called.

You can also search for symbols which is great if you know the name of a function but you don't know in what distribution/module it is declared in.

Anyway, doing source analysis of Perl-code is extremlly difficult, and it won't handle some of special things one can do. I wish I had a better way to do it than with regular expressions. Only perl can parse Perl!

I plan to have a public demo site up today or later this week. The URL will be posted in my journal.

Hopefully, you guys will find this useful.

/Claes
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Wow! Definitely post the URL when it is available.
  • Hi,

    I was at YAPC::Europe last July, and I decided to try OODoc.

    OODoc requires a lot of documentation to be written out of the box, but beeing a lazy bastard, I subclassed it to generate documentation for me (basic stuff).

    I also do perl code parsing. If you like to compare code, or look at my code for it, email/jabber me at melo(at)isp.novis.pt.

    Looking forward to seeing this in action!
    --
    life is too short
  • CPAN!

    Adam Kennedy has written PPI [cpan.org] which takes a good stab and parsing Perl with perl.

    --

    broquaint out

  • You might also look at using Module::Info, which (AFAIK) grovels around a bit in the op-tree to gather information. On the downside, you probably have to install the modules to make full use of M::I. However, you might be able to attach this as a "trojan" on CPANTS.

    /s

    • Module::Info can extract some information without loading the module, but to get what I need it has to load it so it's unfortunetly not an option.

      /me imagines a machine with all CPAN modules installed !

      • Hence the suggestion to piggyback this on top of CPANTS. To test a module, you have to have enough of an installation to make it run and function. So after running the tests (if they pass), CPANTS could automatically run a function to gather Module::Info data to send back with the results. I'm not sure how bad the politics of such a move would be, but it seems like a natural way to distribute an otherwise expensive computation.

        /s

  • Hi!

    For some part of Module::CPANTS::Generator, I wrote a parser (using Parse::RecDescent) that can parse (sort of good, I hope) a small aspect of Perl, namely "use" statements.

    The module is called Module-ExtractUse, it's on CPAN [cpan.org] and you can view the results in Module::CPANTS' "uses" field.

    You might find it interesting. I'm definitly interested in your results (and I assume they will flow into Module::CPANTS?)

    While we're at it, take a look at this: CPANTS Web Interface [domm.zsi.at]