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

I see the previous question about obtaining a list of directories, but we are currently attemting to write a script that will do that, but then take it a few steps further. Below is the desrciption of the functionality that is needed and if anyone knows of anything that performs these functions either in whole or in part, please advise. Thank you for sharing your knowledge.

The program must:

The closest thing that I seen done that accomplished close to what we need the automatic JAVA API generator, however, if I remember correctly, that required special tags within the code. This perl script will have to use the key words within PERL to gather the data because the numbers of files are just too large and there is minimal commenting inside each one.

I hope that this explanation is sufficient, post any questions you may have regarding the requirements and I will address them as soon as I possibly can.

the_Don
...making offers others can't rufuse.

Replies are listed 'Best First'.
Re: Application API Automatically?
by RMGir (Prior) on Jul 29, 2002 at 20:52 UTC
    That sounds a LOT like B::Xref.

    I'm not sure what state that module is in, although since it's include with 5.8.0, it's probably ok.

    A combination of that, File::Find, and making sure you cache the files you've already Xref'd so you don't repeat your work would probably do the job, I hope.
    --
    Mike

Re: Application API Automatically?
by hakkr (Chaplain) on Jul 30, 2002 at 09:41 UTC
    Class::MethodMaker and Class:Struct can be used to automatically create class templates. That is you specify a set of parameters and they create the constructor, accessors and init methods for you. You might find Chapter 8 of OO Perl by Damien Conway 'Automating class creation' helpful. Once you have the list of files using File:find as suggested it sounds like you could just extract the subroutine name you need from the files a regex.
    my @subnames; #open this source file open FILE, '/perlsource.pl/'; while (<FILE>) { #if sub name push onto array of sub names if ($_=~/sub\s+(\S+)\s+\{/) { push @subnames, $1; } } close FILE;
Re: Application API Automatically?
by the_Don (Scribe) on Aug 01, 2002 at 15:16 UTC
    I would just like to thank the Monks and their loyal following for offering their advise so quickly and effectively. My first real question to the Monastery has been a truly productive experience.

    Thank You.

    the_Don
    ...making offers others can't rufuse.