[tapx-dev] [commit][211] Started work on 5.0.5 compatibility.

andy at hexten.net andy at hexten.net
Thu Aug 9 00:45:10 BST 2007


Revision: 211
Author:   andy
Date:     2007-08-09 00:45:10 +0100 (Thu, 09 Aug 2007)

Log Message:
-----------
Started work on 5.0.5 compatibility. t/000-load.t and t/010-base.t pass now. Some ugliness already.

Modified Paths:
--------------
    trunk/Makefile.PL
    trunk/lib/TAP/Harness/Color.pm
    trunk/lib/TAP/Harness.pm
    trunk/lib/TAP/Parser/Aggregator.pm
    trunk/lib/TAP/Parser/Iterator/Process.pm
    trunk/lib/TAP/Parser/YAMLish/Reader.pm
    trunk/lib/TAP/Parser/YAMLish/Writer.pm
    trunk/t/020-regression.t

Modified: trunk/Makefile.PL
===================================================================
--- trunk/Makefile.PL	2007-08-08 19:44:22 UTC (rev 210)
+++ trunk/Makefile.PL	2007-08-08 23:45:10 UTC (rev 211)
@@ -1,7 +1,6 @@
 use ExtUtils::MakeMaker qw/WriteMakefile prompt/;
 
 use strict;
-use warnings;
 
 eval 'use ExtUtils::MakeMaker::Coverage';
 warn "Optional ExtUtils::MakeMaker::Coverage not available\n" if $@;

Modified: trunk/lib/TAP/Harness/Color.pm
===================================================================
--- trunk/lib/TAP/Harness/Color.pm	2007-08-08 19:44:22 UTC (rev 210)
+++ trunk/lib/TAP/Harness/Color.pm	2007-08-08 23:45:10 UTC (rev 211)
@@ -1,7 +1,6 @@
 package TAP::Harness::Color;
 
 use strict;
-use warnings;
 
 use TAP::Parser;
 use TAP::Harness;

Modified: trunk/lib/TAP/Harness.pm
===================================================================
--- trunk/lib/TAP/Harness.pm	2007-08-08 19:44:22 UTC (rev 210)
+++ trunk/lib/TAP/Harness.pm	2007-08-08 23:45:10 UTC (rev 211)
@@ -1,7 +1,6 @@
 package TAP::Harness;
 
 use strict;
-use warnings;
 use Benchmark;
 use File::Spec;
 use File::Path;
@@ -503,10 +502,10 @@
     my $output = $method eq 'failed' ? 'failure_output' : 'output';
     my $test   = $self->_curr_test;
     my $parser = $self->_curr_parser;
-    if ( $parser->$method ) {
+    if ( $parser->$method() ) {
         $self->_summary_test_header( $test, $parser );
         $self->$output($name);
-        my @results = $self->balanced_range( 40, $parser->$method );
+        my @results = $self->balanced_range( 40, $parser->$method() );
         $self->$output( sprintf "%s\n" => shift @results );
         my $spaces = ' ' x 16;
         while (@results) {
@@ -803,7 +802,7 @@
         eval { mkpath($path) };
         $self->_croak($@) if $@;
 
-        open( my $spool_handle, '>', $spool )
+        open( my $spool_handle, ">$spool" )
           or $self->_croak(" Can't write $spool ( $! ) ");
         return $self->{spool} = $spool_handle;
     }

Modified: trunk/lib/TAP/Parser/Aggregator.pm
===================================================================
--- trunk/lib/TAP/Parser/Aggregator.pm	2007-08-08 19:44:22 UTC (rev 210)
+++ trunk/lib/TAP/Parser/Aggregator.pm	2007-08-08 23:45:10 UTC (rev 211)
@@ -121,7 +121,8 @@
     $self->{parser_for}{$description} = $parser;
 
     while ( my ( $summary, $method ) = each %SUMMARY_METHOD_FOR ) {
-        if ( my $count = $parser->$method ) {
+        my $count = $parser->$method();
+        if ( $count ) {
             $self->{$summary} += $count;
             push @{ $self->{"descriptions_for_$summary"} } => $description;
         }

Modified: trunk/lib/TAP/Parser/Iterator/Process.pm
===================================================================
--- trunk/lib/TAP/Parser/Iterator/Process.pm	2007-08-08 19:44:22 UTC (rev 210)
+++ trunk/lib/TAP/Parser/Iterator/Process.pm	2007-08-08 23:45:10 UTC (rev 211)
@@ -9,9 +9,9 @@
 use IO::Select;
 use IO::Handle;
 
-use constant IS_WIN32 => ( $^O =~ /^(MS)?Win32$/ );
-use constant IS_MACOS => ( $^O eq 'MacOS' );
-use constant IS_VMS   => ( $^O eq 'VMS' );
+my $IS_WIN32 = ( $^O =~ /^(MS)?Win32$/ );
+my $IS_MACOS = ( $^O eq 'MacOS' );
+my $IS_VMS   = ( $^O eq 'VMS' );
 
 =head1 NAME
 
@@ -89,18 +89,24 @@
 
     my $out = IO::Handle->new;
 
-    if (IS_WIN32) {
+    if ($IS_WIN32) {
         eval {
-            $pid = open3( undef, $out, $merge ? undef: '>&STDERR', @command );
+            $pid
+              = open3( undef, $out, $merge ? undef : '>&STDERR', @command );
         };
         die "Could not execute (@command): $@" if $@;
-        binmode $out, ':crlf';
+        if ( $] >= 5.006 ) {
+            # Kludge to avoid warning under 5.0.5
+            my @a = ( $out, ':crlf' );
+            binmode @a;
+        }
     }
     else {
-        $err = $merge ? undef: IO::Handle->new;
-        eval { $pid = open3( undef, $out, $err, @command ); };
+        $err = $merge ? undef : IO::Handle->new;
+        my $wtr = IO::Handle->new;
+        eval { $pid = open3( $wtr, $out, $err, @command ); };
         die "Could not execute (@command): $@" if $@;
-        $sel = $merge ? undef: IO::Select->new( $out, $err );
+        $sel = $merge ? undef : IO::Select->new( $out, $err );
     }
 
     my $self = bless {

Modified: trunk/lib/TAP/Parser/YAMLish/Reader.pm
===================================================================
--- trunk/lib/TAP/Parser/YAMLish/Reader.pm	2007-08-08 19:44:22 UTC (rev 210)
+++ trunk/lib/TAP/Parser/YAMLish/Reader.pm	2007-08-08 23:45:10 UTC (rev 211)
@@ -1,7 +1,6 @@
 package TAP::Parser::YAMLish::Reader;
 
 use strict;
-use warnings;
 
 use vars qw{$VERSION};
 

Modified: trunk/lib/TAP/Parser/YAMLish/Writer.pm
===================================================================
--- trunk/lib/TAP/Parser/YAMLish/Writer.pm	2007-08-08 19:44:22 UTC (rev 210)
+++ trunk/lib/TAP/Parser/YAMLish/Writer.pm	2007-08-08 23:45:10 UTC (rev 211)
@@ -1,7 +1,6 @@
 package TAP::Parser::YAMLish::Writer;
 
 use strict;
-use warnings;
 
 use vars qw{$VERSION};
 

Modified: trunk/t/020-regression.t
===================================================================
--- trunk/t/020-regression.t	2007-08-08 19:44:22 UTC (rev 210)
+++ trunk/t/020-regression.t	2007-08-08 23:45:10 UTC (rev 211)
@@ -3030,21 +3030,21 @@
     else {
         while ( my ( $method, $answer ) = each %$details ) {
             if ( my $handler = $HANDLER_FOR{ $answer || '' } ) {    # yuck
-                ok $handler->( $parser->$method ),
+                ok $handler->( $parser->$method() ),
                   "... and $method should return a reasonable value ($test)";
             }
             elsif ( !ref $answer ) {
                 local $^W;    # uninit warnings
-                is $parser->$method, $answer,
+                is $parser->$method(), $answer,
                   "... and $method should equal $answer ($test)";
             }
             else {
-                is scalar $parser->$method, scalar @$answer,
+                is scalar $parser->$method(), scalar @$answer,
                   "... and $method should be the correct amount ($test)";
-                is_deeply [ $parser->$method ], $answer,
+                is_deeply [ $parser->$method() ], $answer,
                   "...... and the correct values ($test)"
                   or
-                  diag +Data::Dumper->Dump( [ [ $parser->$method ], $answer ],
+                  diag +Data::Dumper->Dump( [ [ $parser->$method() ], $answer ],
                     [ '*got', '*expected' ] );
             }
         }
@@ -3068,15 +3068,15 @@
         $count++;
         while ( my ( $method, $answer ) = each %$expected ) {
             if ( my $handler = $HANDLER_FOR{ $answer || '' } ) {    # yuck
-                ok $handler->( $result->$method ),
+                ok $handler->( $result->$method() ),
                   "... and $method should return a reasonable value ($test)";
             }
             elsif ( ref $answer ) {
-                is_deeply $result->$method, $answer,
+                is_deeply $result->$method(), $answer,
                   "... and $method should return the correct answer ($test)";
             }
             else {
-                is $result->$method, $answer,
+                is $result->$method(), $answer,
                   "... and $method should return the correct answer ($test)";
             }
         }




More information about the tapx-dev mailing list