A recent node, 346360, discusses providing suggestions that don't involve modules that need to be acquired from CPAN.

For those not interested in reading that node (though it was a popular one -- lotta votes), here's a summary of a subthread that shot off from it:

Someone replied to this, preaching the wonderfulness of CPAN, and saying that all Perl really needs is the bare minimum to get Perl to bootstrap itself, plus CPAN.pm.

Someone else mentions how easy it is to install modules from CPAN, and that they rarely fail to install.

A few people replied to that, saying that modules often do fail to install.

This discussion has diverged enough from the original thread that I believe it merits its own thread, and I will start it off with an experience I had today. Keep in mind that I have lots of experience with this, and try to imagine how far a newcomer would have gotten trying to do this.

First off, I'd like to say that I use Win32. (For the purists -- face it, it's on 98% of the machines out there. If you only think that Perl should run on 2% of the world's computers, you can go ahead and stop reading now.) I also have Visual C++ installed on my machine, which means I can use CPAN, even to install XS modules. And I do. (Why not PPM? Maybe there is no PPM for whatever module I want to install. Or maybe the PPM is of an out-of-date version.) This setup makes it easy for me to tell when people forget about portability. I can't remember the number of modules that failed to install because a *test* script used `pwd` instead of the Cwd module.

OK, prelude over. Warning: this is long.

I needed to do some accurate math on dates/times coming back in a 'datetime' field from a SQL Query (MS SQL Server). I originally tried using the builtin datediff() function, but it was too difficult to get millisecond-accurate numbers (I kept getting overflow errors). So I searched CPAN for 'DBI datetime format' for a module that would handle that sort of thing, and I got back DateTime::Format::DBI as the first result. Wow, what luck! I clicked the link and read the POD. Lo and behold, it looked perfect! I brought up a command prompt and went:
perl -MCPAN -e shell
cpan> install DateTime::Format::DBI
Well, it installed most of its dependencies automatically (as I had configured my CPAN to do so). However, it told me I needed to install Module::Build to install it, and *prompted* me to find out if it should do so. I said 'yes'.

Before it scrolled off the screen, I managed to catch Module::Build saying that my version of Archive::Tar was older than the one it was looking for, and that if I had problems, I should update it.

I ran into problems (some 'create_archive' method or something was missing). So I exited CPAN (because it seems to be screwy for installing other modules after failures in the same session) and told it to install Archive::Tar. That went off without a hitch. I then attempted to install DateTime::Format::DBI again. This time it mostly-silently-failed. No real error messages, but nmake's output indicated that it wasn't actually doing anything.

I looked more carefully and I saw this message:

Compression not available -- install IO::Zlib!
I guessed that Module::Build needed Archive::Tar and IO::Zlib, so I restarted CPAN again, this time telling it to install IO::Zlib.

I got the same result this time. More-or-less blank output from nmake, and a message informing me that to install IO::Zlib, I needed to first install IO::Zlib.

Great. I need IO::Zlib in order to install IO::Zlib.

I was starting to get very frustrated by now. This time, I loaded up ppm, and told *it* to install IO::Zlib. It complied, and told me it was successful -- but only AFTER warning me that "Compression not available -- Install IO::Zlib!". Wow -- CPAN and PPM were both broken!

(It was about this time that I resolved to write up this node later this evening.)

I eventually got out of my predicament by manually downloading the IO::Zlib tar.gz from a CPAN mirror, and installing it manually.

I brought CPAN back up, and tried the install again. This time, it finally succeeded (mostly; it failed a bunch of tests, and I had to override it with 'force install'. So I have no idea if it was correct.)

I plugged in some code based on the example from the POD, and the very first thing I find out is that DateTime::Format::DBI can't handle the 'MSSQL' datetime type.

I ended up having to parse the datetimes with a regular expression.

OK, </rant>. I think the lesson here is this: We all need to remember that while CPAN is a very comprehensive archive, the modules within may not be entirely comprehensive in the features we may think they're supposed to provide.

--Stevie-O
$"=$,,$_=q>|\p4<6 8p<M/_|<('=> .q>.<4-KI<l|2$<6%s!<qn#F<>;$, .=pack'N*',"@{[unpack'C*',$_] }"for split/</;$_=$,,y[A-Z a-z] {}cd;print lc

Replies are listed 'Best First'.
Re: On installing modules with CPAN.pm
by perrin (Chancellor) on Apr 22, 2004 at 03:23 UTC
    I think the lesson here is this: We all need to remember that while CPAN is a very comprehensive archive, the modules within may not be entirely comprehensive in the features we may think they're supposed to provide

    I would say it's more like "be sure to read the POD and look at the dependencies of a module before you go to the effort of installing it." It looks like one of the first statements in the POD is that it only supports MySQL and Pg. POD and dependencies are available for pretty much every module on either of the CPAN search engines, and I never install anything without checking it out on there first.

    However, your install difficulties teach another lesson: be careful about adding dependencies on XS-based modules if you want your module to run on Win32.

    The flip side of that is that you have to realize that many people are not targetting Win32. It may have a majority of desktops (though surely not 98% as you say), but Linux/BSD is the most common platform for Perl development and has been for years. Win32 support in Perl is amazingly good, but the users on that platform are still a minority, and have to expect a bit more difficulty getting some things to work. It's like being a gamer on a Macintosh: the best stuff typically gets ported, but not everything, and sometimes you have to wait a little while.

      You are entirely correct. I had missed the line stating its limitation to MySQL and Postgres -- I confess I didn't read the entire POD through. In my defense, I did look -- but I was looking for a BUGS or LIMITATIONS type of section, and the limitation is listed in the DESCRIPTION section.

      Win32 support in Perl is nothing short of incredible. When I was able to follow *identical* directions (from perlxstut) on Windows and Linux to flawlessly produce an XS module from h2xs, I nearly fell out of my chair.

      And, yes, I am in the minority. But it just grates me when something won't work because they did something like use `pwd` instead of use Cwd, or something depends on a case-sensitive filesystem (there was another meditation on that recently).

      However, I wonder I would have been spared the IO::Zlib trouble I suffered on any other OS...

      --Stevie-O
      $"=$,,$_=q>|\p4<6 8p<M/_|<('=> .q>.<4-KI<l|2$<6%s!<qn#F<>;$, .=pack'N*',"@{[unpack'C*',$_] }"for split/</;$_=$,,y[A-Z a-z] {}cd;print lc
Re: On installing modules with CPAN.pm
by autarch (Hermit) on Apr 22, 2004 at 04:31 UTC

    plugged in some code based on the example from the POD, and the very first thing I find out is that DateTime::Format::DBI can't handle the 'MSSQL' datetime type.

    So write DateTime::Format::MSSQL and put it on CPAN. It'll take you an hour or so, and when you're done, you'll probably never have to mess with it again.

    Look, there's even a guide for writing formatting/parsing modules for the DateTime project, so you don't have to make any decisions ;)

      Or better yet, write an update for DateTime::Format::DBI and submit it to the original author.
        Actually, DateTime::Format::DBI is just a wrapper around other modules. For it to work with DatabaseX, there must be a corresponding DateTime::Format::DatabaseX module.
Re: On installing modules with CPAN.pm
by hardburn (Abbot) on Apr 22, 2004 at 13:37 UTC

    For the purists -- face it, it's on 98% of the machines out there.

    It's on 98% of the desktops. Perl has never been popular with desktop programming (though I know some people have done it, or else the multitude of GUI API modules wouldn't exist). It has primarily been used for server-side and sysadmin tasks, where Win32 dominance isn't as clear.

    Getting to your main point: CPAN.pm is a mess, and I think people who have used it for a significant length of time know this. It tends to run itself into infinate loops, hang its own process, and occasionally spawn evil spirits who will come and slay you and your family in the night.

    In short, use CPANPLUS.pm.

    ----
    : () { :|:& };:

    Note: All code is untested, unless otherwise stated

Re: On installing modules with CPAN.pm
by herveus (Prior) on Apr 22, 2004 at 11:24 UTC
    Howdy!

    First off, I'd like to say that I use Win32. (For the purists -- face it, it's on 98% of the machines out there. If you only think that Perl should run on 2% of the world's computers, you can go ahead and stop reading now.)

    Unless you were aiming to be deliberately provocative, that parenthetical remark added no value to your message. It gave a screed-like quality to the entire message, tainting it as scorching a few grains of rice in the pot ruins the whole batch. It belies a lack of care and concern.

    Others have spoken to the substantive matters, so I won't recapitulate them.

    yours,
    Michael