Hey all, quick thought

What do people think of adding a requirement to modules being added to CPAN, requesting other module dependancies to be listed along with the module info? I'm picturing something to the effect of requires: Net::FTP, MIME::Base64, etc... I mean I'm in no way affiliated with CPAN, nor do I know any one who is, but if people think it is a decent idea we can always send email :).

Granted their are automated ways to grab the dependancies (IIRC via a CPAN module), but I'm presently working at a job where this isn't an option. Also granted, the time taken to grab another module isn't that long, and CPAN's interface has been great lately. It's simply a pain that I don't think needs to be there.

It would be great to grab a module to use, see that it has dependancies, and check your perl installation for those modules prior to moving away from the browser, as opposed to post perl Makefile.PL..

Thoughts? Comments?

Update: I know this has probably come up before, and I admit to being lazy and not SuperSearching, or checking mailing lists. So for that I apologize, but would still like to see what people think about this issue right now.

/* And the Creator, against his better judgement, wrote man.c */

Replies are listed 'Best First'.
Re: CPAN and module dependancies
by Ovid (Cardinal) on Nov 05, 2002 at 23:38 UTC

    To see the dependancies for HTML::TokeParser::Simple, go to http://search.cpan.org/src/OVID/HTML-TokeParser-Simple-1.3/Makefile.PL. With the new CPAN (not necessarily the mirrors), go to the main page of a module, click on "browse" and select Makefile.PL. If it's done correctly, as Abigail-II points out, you should see something like the following.

    use ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'HTML::TokeParser::Simple', 'VERSION_FROM' => 'Simple.pm', # finds $VERSION 'PREREQ_PM' => { 'HTML::Parser' => 3.25 }, ($] >= 5.005 ? (AUTHOR => 'Curtis "Ovid" Poe <poec@yahoo.com>') : ()), );

    As you can see from the above, the module requires HTML::Parser. Unfortunately, that should actually read HTML::TokeParser, but I didn't discover the mistake until I responded to your post :)

    Cheers,
    Ovid

    Join the Perlmonks Setiathome Group.
    New address of my CGI Course.

Re: CPAN and module dependancies
by Abigail-II (Bishop) on Nov 05, 2002 at 19:34 UTC
    To get the requirements for say, Date::Calc, use the following one-liner:
    tar xfvzO Date-Calc-5.3.tar.gz Date-Calc-5.3/Makefile.PL | grep PR +EREQ_PM

    I don't think it's a good idea to make any requirements for modules uploaded to CPAN. Modules uploaded to CPAN are a gift from their authors; we should be happy. Adding requirements will make that you'll lose some authors.

    Abigail

      no no no... The other way..

      When an author uploads a module, they can add something to the effect of

      Module Dependancies:
      Net::FTP
      MIME::Base64
      Digest::MD5

      That way when you go to grab module A, you can check for modules b,c,d in your installation, and grab those as well if needed.

      Update: Ahh.. I see what you are saying, but wouldn't it make sense? I mean there have been times (notably Net::SSH::Perl), where I would have loved to know that I needed over a dozen other modules, prior to trying to get it working on a host.

      I hear what you are saying about possibly pushing authors away, but do you honestly think that will happen? I don't know what kind of reqs there are for getting your module on CPAN, but I can assume a simple find . -name "*.plm" -print | xargs grep "^use" wouldn't be that much more work..

      /* And the Creator, against his better judgement, wrote man.c */
        No, it doesn't make sense. The information is already provided, it's in Makefile.PL (assuming a proper Makefile.PL). And if you go to search.cpan.org, search for a module, and then browse it, you can see the content of Makefile.PL.

        If you still find this too much of a hassle, I suggest volunteering to write a patch for PAUSE that extracts the information from Makefile.PL and puts the information somewhere to your liking. No need to require authors to do redundant things.

        Abigail

Re: CPAN and module dependancies
by hossman (Prior) on Nov 06, 2002 at 06:05 UTC

    It sounds like what you really want is for the Dependencies to show up on the search.cpan.org page for each distrobution (right next to the "CPAN Testers" or "CPAN Request Tracker" links perhaps)

    What people have tried to explain so far is that it's not neccessary for Module authors to do anything new for this to happen. For wellformed Distrobutions, the info is allready in the PREREQ_PM section of Makefile.PL (And for modules whose Makefile.PL isn't wellformed, it would be just as easy to fix that as to do something new). What's needed is for something on the search.cpan.org site to parse the Makefile.PL and surface the list.

    The appropriate place to submit suggestions like this is the search.cpan.org feedback form.

Re: CPAN and module dependancies
by PodMaster (Abbot) on Nov 06, 2002 at 08:22 UTC
    I don't think this is neccessary, or a pain or anything like that.

    CPAN.org already provides the README for every module, and that info should be in the README, as detailed as an author wants it to be. See:

    E:\new>h2xs -AX Foo::Bar Writing Foo/Bar/Bar.pm Writing Foo/Bar/Makefile.PL Writing Foo/Bar/README Writing Foo/Bar/test.pl Writing Foo/Bar/Changes Writing Foo/Bar/MANIFEST E:\new>more "Foo/Bar/README" Foo/Bar version 0.01 ==================== The README is used to introduce the module and provide instructions on how to install the module, any machine dependencies it may have (for example C compilers and installed libraries) and any other information that should be provided before the module is installed. A README file is required for CPAN modules since CPAN extracts the README file from a module distribution so that people browsing the archive can use it get an idea of the modules uses. It is usually a good idea to provide version information here so that people can decide whether fixes for the module are worth downloading. INSTALLATION To install this module type the following: perl Makefile.PL make make test make install DEPENDENCIES This module requires these other modules and libraries: blah blah blah COPYRIGHT AND LICENCE Put the correct copyright and licence information here. Copyright (C) 2002 A. U. Thor This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

    ____________________________________________________
    ** The Third rule of perl club is a statement of fact: pod is sexy.

Re: CPAN and module dependancies
by Nitrox (Chaplain) on Nov 06, 2002 at 04:41 UTC
    I've always had good luck with just eye-balling the readme online to find pre-req's as in:
    File-Cache-0.16.readme

    -Nitrox

Re: CPAN and module dependancies
by Aristotle (Chancellor) on Nov 06, 2002 at 13:13 UTC

    Even if you had that option, it would still be a pain: you may be missing dependencies of a dependency of a module you're installing. There is no way to add all that information without knowledge of what is installed at your site.

    The immediate dependencies of the one module you're looking at are already viewable, as already pointed out by others.

    Makeshifts last the longest.