Skip to content

Commit

Permalink
Remove Test::Builder::IO::Scalar
Browse files Browse the repository at this point in the history
Fixes #1016
  • Loading branch information
exodist committed Dec 20, 2024
1 parent b1a05c4 commit 0eda12c
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 703 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

{{$NEXT}}

- Remove Test::Builder::IO::Scalar
- Fix #1016

1.302205 2024-12-19 09:28:05-08:00 America/Los_Angeles

- Use our instead of 'use vars'
Expand Down
26 changes: 6 additions & 20 deletions lib/Test/Builder.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ use warnings;

our $VERSION = '1.302206';

BEGIN {
if( $] < 5.008 ) {
require Test::Builder::IO::Scalar;
}
}

use Scalar::Util qw/blessed reftype weaken/;

use Test2::Util qw/USE_THREADS try get_tid/;
Expand Down Expand Up @@ -1366,27 +1360,19 @@ sub todo_output {

sub _new_fh {
my $self = shift;
my($file_or_fh) = shift;
my ($file_or_fh) = shift;

my $fh;
if( $self->is_fh($file_or_fh) ) {
if ($self->is_fh($file_or_fh)) {
$fh = $file_or_fh;
}
elsif( ref $file_or_fh eq 'SCALAR' ) {
# Scalar refs as filehandles was added in 5.8.
if( $] >= 5.008 ) {
open $fh, ">>", $file_or_fh
or $self->croak("Can't open scalar ref $file_or_fh: $!");
}
# Emulate scalar ref filehandles with a tie.
else {
$fh = Test::Builder::IO::Scalar->new($file_or_fh)
or $self->croak("Can't tie scalar ref $file_or_fh");
}
elsif (ref $file_or_fh eq 'SCALAR') {
open $fh, ">>", $file_or_fh
or $self->croak("Can't open scalar ref $file_or_fh: $!");
}
else {
open $fh, ">", $file_or_fh
or $self->croak("Can't open test output log $file_or_fh: $!");
or $self->croak("Can't open test output log $file_or_fh: $!");
_autoflush($fh);
}

Expand Down
Loading

0 comments on commit 0eda12c

Please sign in to comment.