in reply to Perl open pipe exiting early

Why not print out the error string $! to see what's failing?

Replies are listed 'Best First'.
Re^2: Perl open pipe exiting early
by albob (Sexton) on Apr 03, 2015 at 12:07 UTC
    Yes, I missed that one. I should be doing that. Hopefully that will give me a pointer. Thanks
      No luck with this, ubless I messed up the way I added it:
      my $run_pid = open(RUN, "sub_script.pl $options 2>&1 |") or $sub_fai +led = 1; if (!$sub_failed) { $text .= "Entered if (!\$sub_failed) {\n"; while (<RUN>) { $text .= "Entered while (<RUN>)\n"; chomp; $_ =~ s/^\s*//; $text .= "$_\n"; } close(RUN); if ($? != 0) { $sub_failed = 1; $text = "Open error: $!\n";} } else { $text .= "Failed to open sub_script.pl\n";} print "$text";
      $! returned empty. I could well be using it incorrectly though.
        Calling close changes $!. Store its value immediately after the failed open.
        لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ