Releasing a module with additional dependencies

Abigail abigail at abigail.be
Tue Apr 15 16:40:37 BST 2014


On Tue, Apr 15, 2014 at 03:27:07PM +0100, Andrew Beverley wrote:
> Hi guys,
> 
> A bit of a newbie question on publishing a module.
> 
> I've just taken over as maintainer of Device::VantagePro and released a
> new version with some additional features. One of the features
> (get_timezone) requires DateTime::TimeZone, which was not previously
> needed.
> 
> I need some advice as to whether I should:
> 
> 1. Make DateTime::TimeZone a new mandatory dependency for the whole
> module, even though people might not need the functionality that relies
> on it. This is my preference, but is that approach considered to be a
> Bad Thing?
> 
> 2. Add DateTime::Timezone as an optional dependency. In this case could
> someone please point me in the direction of instructions on how to do
> this (Google is failing me).
> 
> Currently the module is failing build tests as I have not implemented
> either of these options.



I've made some CPAN modules that uses some modules during testing
if they're available, and just skips some tests if not.

I do not list the optional modules in Makefile.PL as a dependency
(they are, after all, optional).

And I write my tests like this:

    #!/usr/bin/perl

    use 5.010;

    use strict;
    use warnings;
    no  warnings 'syntax';

    my $r = eval "require Test::NoWarnings; 1";

    use Test::More;
    use My::Module::To::Test;

    ... tests ...

    Test::NoWarnings::had_no_warnings () if $r;

    done_testing;

    __END__



Abigail


More information about the london.pm mailing list