Dist::Zilla Hates Bugs

Today in the Dist-Pen I am going to have a quick Post-ette.

In yesterday’s post I was a little disappointed with Dist::Zilla::Plugin::Test::Legal not working, so for today’s post I was going to have a look at it and see why.

Well to start off I did do a force install yesterday which is never a good way to do things but I was a little short of time. Looking at the code in Dist::Zilla::Plugin::Test::Legal the part I we are interested in is only a few lines long;


_DATA__
__[ xt/release/test-legal.t ]__
use strict;
use warnings;
 
use Test::More;
 
eval 'use Test::Legal';
plan skip_all => 'Test::Legal required for testing licenses'
  if $@
 
copyright_ok;
license_ok;

and I already tried in my last post to 'fix' the above with a ';' at the end of the .if $@'. This is where I am going to start at again. We all know there are quite a few tools about to help one with these tricky installs. Now I had no real issue with the plug-in code so maybe the Test::Legal was the culprit and following up with that the first thing I did was I tried a


sudo cpanm --reinstall Test::Legal

Now this is a little trick that is nice to know because it will go though the full install process again no matter how you might of screwed things up with a forced install or make. It also dumps all the output of the testing to a file making it a little easier to back trace what went on.

After the first run of this I found that Test::Legal wanted something called Test::t installed? I had a look there and saw that this was one funny bird with only 1 line. So seeing no real problem with this one I did a force install of it and tried to re-install Test::Legal again.

This time round I had a problem with Test::Spell was not installed. Now not to bombard you with lots of trivial details, the end problem here was that I needed a 'spell checker' on my box. After a few false starts I finally got ispell installed like this


sudo apt-get install ispell

and then Test::Spell and Test::Legal both installed without error. Moving on I reran my 'dzil xtest release/t' and ended up with

Building Database-Accessor
xt/release/test-legal.t .. Bareword "copyright_ok" not allowed while "strict subs" in use at xt/release/test-legal.t line 10.
Bareword "license_ok" not allowed while "strict subs" in use at xt/release/test-legal.t line 11.
Execution of xt/release/test-legal.t aborted due to compilation errors.
xt/release/test-legal.t .. Dubious, test returned 255 (wstat 65280, 0xff00)

I fails again despite the ';' fix. What is going on here is the test case from the plug-in is not seeing that 'Test::Legal' module that I know is installed and working correctly. In the end the fix was quite simple;


--eval 'use Test::Legal';
--plan skip_all => 'Test::Legal required for testing licenses'
--  if $@
++BEGIN {
++ use_ok('Test::Legal') || print "Bail out!";
++}
and then my 'dzil xtest release/t' and again with this result;
Building Database-Accessor
xt/release/test-legal.t .. ok
All tests successful.
Files=1, Tests=6, 0 wallclock secs ( 0.06 usr 0.02 sys + 0.38 cusr 0.04 csys = 0.50 CPU)
Result: PASS

Now I do not suggest you go playing around in your installed perl like I just did. That is never a good idea. One reason is now my '.ini' file can not be used successfully by anyone else unless they are working with my hacked up perl. I guess that is a bad thing.
Ok so a lot of work just to get a three line test to go. I guess most people just give up and just create that test directly in their '/xt' dir.

One thing I suggest is go out and have a look at the CPANTS and having a look at the sea of yellow and red results for Test::Legal should of told me something was up though the plug-in results looked fine. Looking at the bugs for the plug-in is a good idea as well I see this has been 'fix' but only release a day or two ago though I do see it on CPAN but not on METACPAN for some reason. Still indexing I guess?


hatebugs.jpg

2 Comments

If you look at the test results for the 0.03 version of the plugin, they're all green too. ( http://matrix.cpantesters.org/?dist=Dist-Zilla-Plugin-Test-Legal+0.03 ).

I encountered no errors on my own tests and development environment and I took the green results to mean everything was ok. I didn't think to check the results for the module I was depending on. Bizarre.

I just checked and I don't have Test::Legal installed (it's been a couple of years since I've done anything with perl at all and it's a new environment) ... so how did my tests pass?

Thank you for trying this out. I will see what I can figure out.

Leave a comment

About byterock

user-pic Long time Perl guy, a few CPAN mods allot of work on DBD::Oracle and a few YAPC presentations