Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Module dependencies

by Brovnik (Hermit)
on May 24, 2001 at 20:36 UTC ( [id://82989]=perlmeditation: print w/replies, xml ) Need Help??

Downloading stuff from CPAN, I have found inconsistencies in the management of module dependencies.

Some explicitly check and try to get needed modules.
Some fail gracefully and CPAN.pm asks if you want to get them.
Some just fail during testing and leave you to handle it.

So... I thought it would be nice to build a graph of the dependencies.

I have put together some code to look through all of the installed modules and store in a mysql database the following :

  • Package Name
  • Filename
  • Version
  • Date installed
  • Array of pragmas used
  • Array of modules used
The intention is to allow me to easily generate a graph and some statistics re. the modules.

Before I spend more time on this, I would appreciate some thoughts from you folks.

Has this been done before ? (I looked on CPAN and SuperSearch and didn't find anything)

Would other find it usefult to have this ?

What sort of output would be useful ?

In answer to the last, I am toying with :

  1. Just leave it in the database.
  2. A Web tool which allows browsing up and down the chains.
  3. A visual graph (e.g. using GraphViz)
Item 2 is my favourite and shouldn't be too hard. Visually it will be difficult to display the whole thing, since I have 1040 rows in the table (=packages installed).

Update: Have now done some more work on item 2, sample browser is at Here.

Taking DrZaius's advice, it now also reads the perllocal.pod to get more info and throws that in as well.

Have also added a reverse table, which allows you to see which modules a modules is used by.

The overall effect allows you to browse up and down the tree as you like.

Of course, to solve the original problem of finding out what modules I need to install, this really needs to run on CPAN...
--
Brovnik

Replies are listed 'Best First'.
Re: Module dependencies
by DrZaius (Monk) on May 24, 2001 at 21:09 UTC
    Why not also add the minimum required version?

    I suppose that needs more explenation. I would do my schema like this:

    • modules -- contains information about the module, such as version, package name and so forth
    • dependancies -- a cross ref that maps dependancies. Yes, this circles back to modules. This is where you put minimum required version, if set.

    In this set up, you don't need to record if something is pragma or not as your modules table should contain that data.

    You may also want to explore the fact that a file may contain many modules and that there are pl (perl libraries) that get loaded as well.

    I also recommend writing it with a DBD::CSV backend as it could eventually replace perllocal.

      Useful comments, see my Update above.

      The code as written now copes with several packages per file.
      I haven't so far tried to copes with perl libraries, but the EXE files listed in the pod are recorded.
      As far as backends go, once it is in a DB, output is fairly easy into any format.
      --
      Brovnik

Re: Module dependencies
by Desdinova (Friar) on May 25, 2001 at 19:41 UTC
    I think this is a great idea. One of the liitle things that drives me batty sometimes is when I'm working on a problem, find a good mod. and spend half an afternoon playing connect the dots to try to get all the mods it requires, some of which require thier own and on and on.

    It would be really cool if you could just enter a module name and get a list of it's dependencies, which in turn list thier dependencies. So that you come witha a single list of what you need to download.

    Just my 1/50 of a dollar...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://82989]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (8)
As of 2024-03-28 09:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found