[sf-perl] Dumb Q's about CPAN submission

Fred Moyer fred at redhotpenguin.com
Fri Mar 4 14:29:29 PST 2011

[adding the sf.pm cc back]

On Fri, Mar 4, 2011 at 1:52 PM, Joseph Brenner <doom at kzsu.stanford.edu> wrote:
> (1) I don't think there's any standard usage of perl VERSION that let
> you indicate an alpha version, or something like that.  Just start
> with a very low version, e.g. 0.001,  and bump it up when it makes
> sense to you.  If you like, you can jump it up to 1.00 to indicate
> you're feeling confident about it, but I don't think there's any perl
> culture assumption that there's something magic about version 1.0 (I
> think you'll find that many production ready modules have version
> numbers less than 1).
> (2) To figure out when "done_testing" was added to Test::More, I would
> try looking at it's Changes file.
> (a) Myself, I personally would just avoid using "done_testing" for
> another few years... the fewer new features you use, the easier you'll
> make it on other people to use your code.
> Fred's trickery with Makefile.PL sounds workable (a lot of people
> don't realize that that's really a perl script, so you can include any
> arbitrary code in it).  Another way to deal would be down on the level
> of the t/*.t files... with Test::More you can skip tests that depend
> on features that aren't available.

The point of the trickery here is so that you don't have to require
Test::More in the prerequisites for the module.  Your module (likely)
does not need Test::More to function, just to run the tests.

Why does this matter?  Often in production environments, package based
(read rpm, deb) perl modules will use an additional package to install
Test::More apart from the Perl core rpm.  That might not be a big deal
you say, but when you start to add additional testing modules such as
Test::Deep and Devel::Cover, those are modules that you really don't
need on your production environment.

It is more about separating build and runtime prerequisites from
testing prerequisites than saving a few megs of disk space.

> On Fri, Mar 4, 2011 at 12:33 PM, Fred Moyer <fred at redhotpenguin.com> wrote:
>> On Fri, Mar 4, 2011 at 11:51 AM, Greg Lindahl <greg at blekko.com> wrote:
>>> I'm trying to submit my first CPAN modules and I have some dumb
>>> questions that I haven't found answers for.
>>> 2) I have dependencies with YAML and Test::More -- the one other
>>> system I tried had an older version of Test::More which doesn't
>>> grok 'done_testing()'.
>>> How do I figure out which versions to ask for? Or should I just avoid
>>> done_testing() in cpan modules, so as to tolerate older versions?
>> With regards to running the tests based on the version of Test::More
>> (if I'm understanding your question correctly), I usually use
>> something like this in the Makefile.PL to see if the needed version of
>> Test::More is installed.  If it isn't, the tests don't run.
>> package MY;
>> sub test {
>>    my $self = shift;
>>    eval { require Test::More } or return <<EOF;
>> test::
>> \t\@echo sorry, cannot run tests without Test::More
>> EOF
>>    unless ($Test::More::VERSION > '0.123') {
>>        return <<EOF;
>> test::
>> \t\@echo sorry, need at least version 0.124 of Test::More
>> EOF
>>    return $self->SUPER::test(@_);
>> }
>> _______________________________________________
>> SanFrancisco-pm mailing list
>> SanFrancisco-pm at pm.org
>> http://mail.pm.org/mailman/listinfo/sanfrancisco-pm

More information about the SanFrancisco-pm mailing list