Please Stop Including the Kitchen Sink

I needed to install Business::OnlinePayment::WorldPay @ $work today. I had been using the module in my own perlbrew name space so as to not pollute the server with unnecessary modules, but as the code went live I needed to install it server side.

Little did I know that it triggers once of those dependency cascades that includes the kitchen sink.

The reason is that B:O:WorldPay uses XML::TreeBuilder to parse the XML returned by WorldPay. That is a good reuse of modules.

What isn’t is that XML::TreeBuilder’s author wants to have good Perl Best Practice (PBP) tests and so wrote a test for Perl::Critic. From the naming scheme for this test (xt/author/zz_perlcritic.t) this is clearly not a regular test for most people to use (xt = Extra Tests?).

More over the test itself checks to see if Test::Perl::Critic is installed and if not skips the test:


eval "use Test::Perl::Critic";

if ($@) {
Test::More::plan( skip_all =>
"Test::Perl::Critic required for testing PBP compliance" );
}
else {

So no failures will occur if Test::Perl::Critic and thus Perl::Critic isn’t installed. However because of this exuberance the author added Test::Perl::Critic to the list of dependencies and before you know it my server is busy trying to install Perl::Critic.

Thanks, but no thanks.

A quick install with perl Makefile.PL && make && make install fixes this, but cpanm wouldn’t let me install this without P::C, causing the install to take much longer than it should have done…

The author of XML::TreeBuilder handled this correctly by having the test be contingent on having Test::Perl::Critic, but I don’t think that this should be a required module for the module to install as it is not actually used by the module.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: