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

Greetings Monks, I am running strawberry perl 5.30 under windows 11.

When the program below reaches the start function, it fails with the seemingly nonsensical error "Can't locate auto/Tk/ROText/FILENO.al". Tieing only STDOUT to the same widget is no problem.

Does anyone have any insight as to what is happening here?

use warnings; use strict; use IPC::Run qw(start pump finish timeout); use Tk; require Tk::ROText; my $mw = MainWindow->new(-title => " NON BLOCKING"); my $outw = $mw->Scrolled('ROText', -font => "{Courier New} 10 bold", -background => 'DarkBlue', -foreground => 'OldLace', -scrollbars => 'se', -wrap => 'none', -width => 100, -height => 10, )->pack(-fill => "both", -expand => 1); + # tie *STDOUT, 'Tk::Text', $outw; tie *STDERR, 'Tk::Text', $outw; my ($in, $out, $err) = ('', '', ''); my $h; if (! defined(eval { $h = start ['cmd.exe', '/c', 'dir'], \$in, \$out, + \$err; })) { print "\nStart failed: $@\n"; } while($h->pumpable) { $h->pump; print $out; $out = ''; } $h->finish; MainLoop;
  • Comment on Tieing STDERR to a textbox causes the IPC::Run start function to fail
  • Download Code

Replies are listed 'Best First'.
Re: Tieing STDERR to a textbox causes the IPC::Run start function to fail
by choroba (Cardinal) on Mar 06, 2026 at 01:31 UTC
    Same error on Linux.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re: Tieing STDERR to a textbox causes the IPC::Run start function to fail
by ikegami (Patriarch) on Mar 06, 2026 at 04:13 UTC

    Sounds like fileno( STDERR ) is called by start and the tied file handle doesn't provide a FILENO callback for it.

      Indeed, there's this:

      sub _debug_fd { return fileno STDERR unless defined $cur_self; if ( _debugging && !defined $cur_self->{DEBUG_FD} ) { my $fd = select STDERR; $| = 1; select $fd; $cur_self->{DEBUG_FD} = POSIX::dup fileno STDERR; _debug("debugging fd is $cur_self->{DEBUG_FD}\n") if _debugging_details; } return fileno STDERR unless defined $cur_self->{DEBUG_FD}; return $cur_self->{DEBUG_FD}; }

      It's called a number of places as follows or similar:

      $op->open_pipe( $self->_debug_fd )

      It seems it's used to provide a means for post-fork but pre-exec code in the child to display debug messages without causing issues if the child's STDERR is redirected. For example, you wouldn't want some of the debug messages of run \@cmd, "2>", "err.txt" to end up on STDERR and some of them to end up in `err.txt`.

        That makes sense - thanks very much!