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

In reply to On installing modules with CPAN.pm by Stevie-O

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.