Devel::Cover: uninitialized value warning in 'cover'

James E Keenan <[email protected]>
Newsgroups gmane.comp.lang.perl.quality-assurance
Message-ID <[email protected]>
As I have described previously, I use Devel::Cover to measure the extent 
to which parts of the Parrot virtual machine's test suite exercises 
certain Perl 5 programs and modules in Parrot's configuration and build 
systems.  Today for the first time I noticed this uninitialized value 
warning, which occurs after the test harness has completed and the 
cover_db has been built, but just before I call 'cover' to generate a 
report or summary:

#####
Reading database from /home/jimk/parrot/coverage/configure-build
Use of uninitialized value $Devel::Cover::Ignore_filenames in regexp 
compilation at 
/usr/local/lib/perl5/site_perl/5.16.0/i686-linux/Devel/Cover/DB.pm line 882.


------------------------------------------ ------ ------ ------ ------ 
------
File                                         stmt   bran   cond    sub 
total
------------------------------------------ ------ ------ ------ ------ 
------
/usr/local/bin/perldoc                      100.0   50.0    n/a  100.0 
  90.9
/usr/local/bin/pod2man                       97.1   50.0   33.3  100.0 
  80.4
...
#####

Here are the relevant sections of Devel::Cover::DB:

#####
  852 sub cover
  853 {
  854     my $self = shift;
...
  880             unless ($digest)
  881             {
  882                 print STDERR "Devel::Cover: Can't find digest for 
$file\n"
  883                     unless $Devel::Cover::Silent ||
  884                            $file =~ $Devel::Cover::Ignore_filenames ||
  885                            ($Devel::Cover::Self_cover &&
  886                             $file =~ q|/Devel/Cover[./]|);
  887                 next;
  888             }
#####

I cannot locate any other reference to $Devel::Cover::Ignore_filenames 
in Devel::Cover::DB.  That variable is listed in 'use vars' in 
Devel::Cover, but Devel::Cover::DB doesn't (directly, at least) import 
Devel::Cover.

Here is the point in the 'cover' executable where it appears 
Devel::Cover::DB::cover() is called:

#####
334     my %f = map { $_ => 1 } (@{$Options->{select}}
335                              ? map glob, @{$Options->{select}}
336                              : $db->cover->items);
#####

I can't find any location within 'cover' where 
$Devel::Cover::Ignore_filenames is set to a defined value.  However, 
when I used a hacked-up version of 'cover' with this:

#####
  20 $Devel::Cover::Ignore_filenames = '';
  21 use Devel::Cover::DB;
#####

... the uninitialized value warning went away.

Can we get a less hackish way of preventing this uninitialized value 
warning?

Thank you very much.
Jim Keenan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.