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

Is there any kind of consensus or discussion between the promoters of the Task:: namespace and the Bundle:: namespace? I've read the rationale for Task:: as provided by Adam Kennedy and I think it makes a lot of sense; it seems like a more powerful mechanism for grouping module installations together with additional functionality.

I read the documentation for creating Bundles as explained in the CPAN FAQ. I was able to follow along and successfully create and install a Bundle. It worked largely as advertised.

I have not been as successful with a Task. The documentation tells me how to create a Task, but makes no mention of how to use it. Adam's journal entry specifically mentions using Task::CVSMonitor for reference, which confirms how it should be structured, but again, makes no mention of how to install it.

Doing the normal perl Makefile.PL; make; make test; make install doesn't prompt for missing dependencies; it just warns you and moves on.
[me@unixbox1:/tmp/Task-CVSMonitor-0.006003]> perl Makefile.PL Warning: prerequisite Array::Window 0.4 not found. Warning: prerequisite Chart::Math::Axis 0 not found. Warning: prerequisite Class::Autouse 1.04 not found. Warning: prerequisite Class::Default 1.0 not found. Warning: prerequisite Class::Handle 0 not found. Warning: prerequisite Class::Inspector 1.07 not found. Warning: prerequisite Clone 0.14 not found. Warning: prerequisite Config::Tiny 1.6 not found. Warning: prerequisite Date::Format 0 not found. Warning: prerequisite File::Flat 0.91 not found. Warning: prerequisite GD::Graph 0 not found. Warning: prerequisite GD::Text 0 not found. Warning: prerequisite HTTP::BrowserDetect 0.97 not found. Warning: prerequisite Net::Telnet 0 not found. Warning: prerequisite Number::Compare 0 not found. Warning: prerequisite Proc::ProcessTable 0 not found. Warning: prerequisite Sort::Versions 0 not found. Warning: prerequisite Text::Glob 0 not found. Warning: prerequisite Time::Duration 0 not found. Warning: prerequisite Time::ParseDate 100.010301 not found. Warning: prerequisite Validate::Net 0.5 not found. Warning: prerequisite XML::Generator 0 not found. Writing Makefile for Task::CVSMonitor
Is Task:: not suitable for the "automation" of mass module installs? Are Task:: modules still dependent on CPAN.pm for prerequisite resolution? I think it might be helpful if the documentation addressed this. Additional documentation pointers are welcome.

Replies are listed 'Best First'.
Re: Task:: or Bundle::
by brian_d_foy (Abbot) on Mar 13, 2007 at 18:23 UTC

    Module installation by hand doesn't take care of the dependencies. If you install the Task module with CPAN or CPANPLUS, they'll take care of it, just like for any other module.

    Installing bundles is a separate process and more confusing, so Task makes it look like a normal module installation. I certainly think it's the way to go, especially with things such as CPAN::Mini and CPAN::Mini::Inject which you use to get your local, private modules into the process.

    Update Sure, CPAN.pm makes it look like a Bundle is doing it the same things as a normal module installation, but it's a lot different behind the scenes. To use folks who write the code to handle those things, treating a group of modules just like any other module is much easier than programming a special case. You might care because maintaining that special case distracts from other work. You can do what you like though, I guess, and we'll keep making it work for you. :)

    --
    brian d foy <brian@stonehenge.com>
    Subscribe to The Perl Review

      Now, when using cpan, where does a bundle differ from any other package?

      cpan Bundle::CPAN

      installs just the same as any other module.

      I'm aware that the handling of a bundle is completely different from the handle of other packages by the internals of CPAN and (I guess) CPANPLUS, but as they conveniently shield me from the differences, why should I care?

        Well, for example, Bundle::CPAN ignores the Makefile.PL.

        Instead, it reads the .pm file to look for specially formateed POD entries instead!

        This means there's no capability to do platform-senstive Bundle:: modules. In fact, there's no capability to do ANY sort of interesting things.

        You write it in the POD, hope you don't accidentally write something in the POD that the CPAN client will mistake for a module, and than pack it up with a Makefile.PL that does nothing.

        Oh, and because Bundle:: modules are never installed, you can never tell whether a Bundle:: module has been installed of not.

        They are completely invisible.

        This can lead to some scenarios where you want a specific tarball version installed (not just a class) and because the Bundle:: doesn't know if it is installed, it just reinstalls the same package all over again.

        If two modules both use the same Bundle:: in your recursion tree, well then it will install it TWICE!

        Oh, and don't expect to be able to use them if you write your own CPAN client or installer, because you yourself have to implement the weirdness inside of them.

        And you can't install a Bundle module by hand with Makefile.PL... well you can, except it will lie to you, because only what's in the POD matters, not what's in the Makefile.PL, so you have to maintain the dep list twice.
Re: Task:: or Bundle::
by adamk (Chaplain) on Mar 14, 2007 at 08:16 UTC
    Task:: modules that are uploaded to CPAN are not necesarily suitable to hand-installing in the way that you want.

    On the other hand (and this is the entire point of Task::) you can use anything that the CPAN configuration module (in this case Module::Install) supports.

    For your situation, try putting the following extra command just before WriteAll.

    auto_install;

    This will cause some extra magic to be bundled into the installer that will spawn off a CPANPLUS instance that DOES do the automation of mass module installs that you want.

    Of course, this assumes you aren't uploading to CPAN. If you are uploading to CPAN, auto_install can still be a bit buggy (it's supposed to silently degrade when running inside an existing CPAN client, but breaks sometimes still) so it's strongly recommended not to use auto_install for modules that are uploaded to the CPAN.
      It's not that I want to hand-install modules. I'm absolutely comfortable using CPAN.pm as the means of automating the install of either a Task:: or a Bundle::, I just didn't understand that it was necessary.

      What really screwed me up was this statement in the Task POD:
      This implementation as a module allows normal Perl tools to be able to load the module and check it's version to confirm you have the required modules, without the need for a CPAN client involved.
      I interpreted that as "CPAN.pm isn't necessary for Task::s". Let's touch up the Task POD to clarify that CPAN.pm use is still appropriate, and even expected, for automated prerequisite resolution.

      I still have the larger question of where the "Perl community" is headed. If there's any kind of consensus that Task:: is preferred over Bundle:: then let's add that to the CPAN FAQ or even to the CPAN.pm POD. I stumbled on Task:: entirely by accident!