IPC-Run icon indicating copy to clipboard operation
IPC-Run copied to clipboard

Two "typos" in IPC::Run::IO::new [rt.cpan.org #111214]

Open toddr opened this issue 8 years ago • 2 comments
trafficstars

Migrated from rt.cpan.org#111214 (status was 'new')

Requestors:

From [email protected] on 2016-01-15 16:16:34:

sub new {
   my $class = shift;
   $class = ref $class || $class;

   my ( $external, $type, $internal ) = ( shift, shift, pop );

   croak "$class: '$_' is not a valid I/O operator"
 <---------------- << $_ >> should be << $type >>
      unless $type =~ /^(?:<<?|>>?)$/;

   my IPC::Run::IO $self = $class->_new_internal(
      $type, undef, undef, $internal, undef, @_
   );

   if ( ! ref $external ) {
      $self->{FILENAME} = $external;
   }
   elsif ( ref eq 'GLOB' || UNIVERSAL::isa( $external, 'IO::Handle' ) ) {
 <---------------- << ref eq 'GLOB' >> should be << ref( $external ) eq
'GLOB' >>
      $self->{HANDLE} = $external;
      $self->{DONT_CLOSE} = 1;
   }
   else {
      croak "$class: cannot accept " . ref( $external ) . " to do I/O with";
   }

   return $self;
}

This also means that there are no tests for $io = io( *HANDLE, '<', $send );

toddr avatar May 12 '17 12:05 toddr

@ikegami What patch are you recommending here?

toddr avatar Mar 27 '18 00:03 toddr

hmmm? It's pretty clearly stated in the previous message. Change << $_ >> to << $type >>, and change << ref eq 'GLOB' >> to << ref( $external ) eq 'GLOB' >>

ikegami avatar Mar 27 '18 21:03 ikegami