http://qs321.pair.com?node_id=612820

swkronenfeld has asked for the wisdom of the Perl Monks concerning the following question:

I just inherited some code that uses Test::Harness::Straps across a variety of platforms. I discovered that I have two different versions of Straps.pm (on two different platforms), but both of them are labeled 0.26.

The biggest difference that I noticed is that the analyze function returns a hash in one version, and returns a reference in the other version.

I was unable to find the change history online for specifically Test::Harness::Straps (I looked in the Test::Harness package change history, but it did not help). Below I have attached the top 20 or so lines from each file, down to the point where you can see that analyze returns a hash for one, and a reference for the other. It appears that the latter is the newer form, as that is what I see on CPAN.

Can anyone enlighten me on this? Rather than upgrading some of the older systems, I am about to put in code that treats the return value differently depending on if it is a reference. But before doing so, I would like to understand why I have different versions on two different systems (with the same version of perl), and why they have the same version number. Thanks!
RHEL 3 - x86 [root@vdt-fc3-ia32 tests]# perl -v This is perl, v5.8.5 built for i386-linux-thread-multi Straps.pm: # -*- Mode: cperl; cperl-indent-level: 4 -*- package Test::Harness::Straps; use strict; use vars qw($VERSION); $VERSION = '0.26'; use Config; use Test::Harness::Assert; use Test::Harness::Iterator; use Test::Harness::Point; # Flags used as return values from our methods. Just for internal # clarification. my $YES = (1==1); my $NO = !$YES; =head1 NAME Test::Harness::Straps - detailed analysis of test results =head1 SYNOPSIS use Test::Harness::Straps; my $strap = Test::Harness::Straps->new; # Various ways to interpret a test my %results = $strap->analyze($name, \@test_output); my %results = $strap->analyze_fh($name, $test_filehandle); my %results = $strap->analyze_file($test_file);

And the other system:
RHEL 4 - x86 [root@vdt-rhas4-ia32 tests]# perl -v This is perl, v5.8.5 built for i386-linux-thread-multi Straps.pm: # -*- Mode: cperl; cperl-indent-level: 4 -*- package Test::Harness::Straps; use strict; use vars qw($VERSION); $VERSION = '0.26'; use Config; use Test::Harness::Assert; use Test::Harness::Iterator; use Test::Harness::Point; use Test::Harness::Results; # Flags used as return values from our methods. Just for internal # clarification. my $YES = (1==1); my $NO = !$YES; =head1 NAME Test::Harness::Straps - detailed analysis of test results =head1 SYNOPSIS use Test::Harness::Straps; my $strap = Test::Harness::Straps->new; # Various ways to interpret a test my $results = $strap->analyze($name, \@test_output); my $results = $strap->analyze_fh($name, $test_filehandle); my $results = $strap->analyze_file($test_file);

Replies are listed 'Best First'.
Re: Test::Harness::Straps->anaylze() return value change
by Khen1950fx (Canon) on May 01, 2007 at 00:49 UTC
Re: Test::Harness::Straps->anaylze() return value change
by adrianh (Chancellor) on May 10, 2007 at 19:37 UTC
    I just inherited some code that uses Test::Harness::Straps across a variety of platforms. I discovered that I have two different versions of Straps.pm (on two different platforms), but both of them are labeled 0.26.

    If you're going to be maintaining this long term you might want to have a look at porting it to TAP::Parser.