I have just noticed an anomalous difference in output between two of the files created by the Devel::Cover 'cover' utility when run against a popular Perl module -- and I am wondering whether this difference should be considered a feature or a bug.

The module in question is Text::Template, which I am studying as part of Perl Seminar NY's contribution to the Phalanx project. Start with a copy of Text-Template-1.44 (the latest on CPAN) and examine the code. In 'lib/Text/Template.pm', consider these two lines:

  128    $self->_acquire_data unless $self->{DATA_ACQUIRED};

  450        if (! defined $val) {

Proceed in the normal manner:

  perl Makefile.PL
  make
  cover -delete
  HARNESS_PERL_SWITCHES=-MDevel::Cover make test
  cover

... 'cover' creates a number of HTML files, including these two:

  ./Text-Template-1.44/cover_db/blib-lib-Text-Template-pm.html
  ./Text-Template-1.44/cover_db/blib-lib-Text-Template-pm--branch.html

'blib-lib-Text-Template-pm.html' displays lines 128 and 450 exactly as they appear in the module itself. 'blib-lib-Text-Template-pm--branch.html', however, displays the relevant branch part of these lines of code as follows:

  128  unless $$self{'DATA_ACQUIRED'}

  450  if (not defined $val) { }

'$self->{DATA_ACQUIRED}' is changed to '$$self{'DATA_ACQUIRED'}' and '! defined $val' is changed to 'not defined $val'. (I could site other examples as well, but these suffice to illustrate the point.)

Now, I grant that these are merely displays, not live code. Nonetheless, since the purpose of these HTML files is to guide a programmer to lines of code whose test coverage needs improvement, I am puzzled as to why the output in these two files differs.

Jim Keenan



Reply via email to