www.frotzware.com

Devel::Cover 0.55 and perl 5.6.1-635 -- Dealing with find_cv() exceptions PDF Print E-mail
Written by Frotz   
Friday, 11 August 2006
This article describes how to deal with down-rev environments if you just have to get Devel::Cover running. It details a couple of secret handshakes that were necessary to get it working that was specific to my target environment. Your mileage may vary.

Dependency Decisions:

You may be wondering why I chose to use Devel::Cover 0.55 instead of the current 0.58. The reason is that for my down-rev environment (5.6.1-635), the significantly increased dependency matrix required by 0.58 could not be justified. Hence, the use of 0.55.

Prerequisites:

Get the prerequisites out of the way. You will need the following:

  1. A Visual C++ compiler if you're on Windows. Otherwise gcc should be fine.

Because Devel::Cover 0.55 is down-rev, you may want to start with downloading this binary and unpacking it. Then perl Makefile.PL will tell you the dependencies that are missing from your environment.

CPAN - Dealing with the Dependencies

Ensure that your compiler is loaded into your environment (e.g. load vsvars32.bat if you're on Windows). Now use cpan install Module::Name to install the missing dependencies. Work through all of the nasty dependencies. This takes quite a while. Don't give up, but do keep all of your downloaded modules so that you don't have to do too much re-work.

Here is a possibly incomplete list (it includes some dependencies from Devel::Cover 0.58 as well as those for 0.55) and it may not be complete because cpan(1) may have cleaned up c:/cpan/build/.

  c:/cpan/build:
  total 2000  free 58352600
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 14:48 .
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:08 ..
  drwxrwxrwx   2 ffaatuai root        0 Aug 10 13:16 Algorithm-Diff-1.1902
  drwxrwxrwx   2 ffaatuai root        0 Aug  8 10:53 AppConfig-1.63
  drwxrwxrwx   2 ffaatuai root        0 Aug 10 14:58 Attribute-Handlers-0.78
  drwxrwxrwx   2 ffaatuai root        0 Aug  8 10:51 CSS-Tiny-1.11
  drwxrwxrwx   2 ffaatuai root        0 Aug 10 14:54 Class-ISA-0.33
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:15 Class-Inspector-1.16
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:10 Clone-0.20
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:12 Config-Tiny-2.08
  drwxrwxrwx   2 ffaatuai root        0 Aug  9 21:07 DBI-1.52
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 13:43 Devel-Cover-0.55
  -rw-rw-rw-   1 ffaatuai root   839680 Aug 11 12:42 Devel-Cover-0.55.tar
  drwxrwxrwx   2 ffaatuai root        0 Aug  8 11:11 Devel-Symdump-2.0602
  drwxrwxrwx   2 ffaatuai root        0 Aug  7 14:17 Digest-MD5-2.36
  drwxrwxrwx   2 ffaatuai root        0 Aug  8 11:07 Digest-SHA-5.43
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:24 ExtUtils-Install-1.41
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:18 ExtUtils-MakeMaker-6.30
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:16 File-HomeDir-0.58
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:17 File-Remove-0.31
  drwxrwxrwx   2 ffaatuai root        0 Aug  8 11:09 Hook-LexWrap-0.20
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:36 IO-String-1.08
  drwxrwxrwx   2 ffaatuai root        0 Aug  8 14:54 IO-Tty-1.07
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:26 List-MoreUtils-0.21
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 14:50 Module-Build-0.2805
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:41 PPI-1.115
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:25 Params-Util-0.15
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:32 PathTools-3.19
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:08 Perl-Tidy-20060719
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:09 Pod-Coverage-0.18
  drwxrwxrwx   2 ffaatuai root        0 Aug  8 11:13 Pod-Escapes-1.04
  drwxrwxrwx   2 ffaatuai root        0 Aug  8 11:13 Pod-Simple-3.04
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:37 Scalar-List-Utils-1.18
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:06 Spiffy-0.30
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:11 Storable-2.15
  drwxrwxrwx   2 ffaatuai root        0 Aug 10 13:06 Sub-Uplevel-0.13
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:40 Task-Weaken-0.99
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:06 Test-Base-0.52
  drwxrwxrwx   2 ffaatuai root        0 Aug 10 14:58 Test-Class-0.11
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:15 Test-ClassAPI-1.02
  drwxrwxrwx   2 ffaatuai root        0 Aug 10 14:53 Test-Differences-0.47
  drwxrwxrwx   2 ffaatuai root        0 Aug 10 13:10 Test-Exception-0.21
  drwxrwxrwx   2 ffaatuai root        0 Aug  8 14:59 Test-Pod-1.26
  drwxrwxrwx   2 ffaatuai root        0 Aug  8 15:04 Test-Pod-Coverage-1.08
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:13 Test-Simple-0.64
  drwxrwxrwx   2 ffaatuai root        0 Aug 10 13:17 Text-Diff-0.35
  drwxrwxrwx   2 ffaatuai root        0 Aug  9 11:10 Win32-NetName-0.3
  drwxrwxrwx   2 ffaatuai root        0 Aug 11 12:07 YAML-0.62

Secret Hand Shakes

The following items drove me nuts on each iteration of getting this installed. (And yes, I did it multiple times.)

Scalar-List-Utils-1.18

On line 38 of Makefile.PL, there is an XSUBPPARG += ... line that Visual Studio .Net 2002 choked on. Removing that line, allowed me to build, test and install this component.

Devel::Cover 0.55 and c:/sd/perl/lib/B.pm

On my last iteration, I kept running into a "find_cv" failure when running the Devel::Cover 0.55 unit tests. I found a reference by Paul Johnson on perl.qa (2225 and 2226) that suggested a try/catch around the error. In digging into the suggested code, it led me to B::walksymtable().

I added a try/catch inside the while loop and the unit test results went from 5% OK to 98% OK. Certainly sufficient for my purposes. Here are the resulting code modifications.

sub walksymtable {
    my ($symref, $method, $recurse, $prefix) = @_;
    my $sym;
    my $ref;
    no strict 'vars';
    local(*glob);
    $prefix = '' unless defined $prefix;
    while (($sym, $ref) = each %$symref) {
        $@ = "";
        eval {
            *glob = "*main::".$prefix.$sym;
            if ($sym =~ /::$/) {
                $sym = $prefix . $sym;
                if ($sym ne "main::" && $sym ne "::" && &$recurse($sym)) {
                    walksymtable(\%glob, $method, $recurse, $sym);
                }
            } else {
                svref_2object(\*glob)->EGV->$method();
            }
        };
        if  ($@) {
            ## Ignore Exception -- ffaatuai 2006-08-11
        }
    }
}

Once I made this change, I was able to install Devel::Cover 0.55 on my down-rev Perl 5.6.1-635 environment.

Notes:

On recent ActivePerls as well as recent Perls on Linux, these tricks were entirely unnecessary. Hopefully, this will save someone a week of development time.

Last Updated ( Friday, 11 August 2006 )
 
< Prev