Skip Menu |

This queue is for tickets about the Perl-Dist-Strawberry CPAN distribution.

Report information
The Basics
Id: 125638
Status: resolved
Priority: 0/
Queue: Perl-Dist-Strawberry

People
Owner: Nobody in particular
Requestors: Barry.Kimelman [...] wellsfargo.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: error handling bug in strawberry Perl 5.24.1
Date: Tue, 19 Jun 2018 18:44:16 +0000
To: <bug-Perl-Dist-Strawberry [...] rt.cpan.org>
From: <Barry.Kimelman [...] wellsfargo.com>
Hello, Here at the office on my 64 bit Windows 10 laptop I have strawberry Perl 5.24.1 I was testing the error handling in one of my scripts and to my surprise the error was not properly trapped. I was attempting to open a pipe to an external program to be used as a "paging" program so that the output from my script would pause after every screenfull of output and wait for me to press a key. To my surprise the error was not trapped and the program just continued on and the "piped" output was sent to nowhere! The source of the demo script is : 1 #!/usr/bin/perl -w 2 3 use strict; 4 use warnings; 5 use Scalar::Util; 6 use FindBin; 7 use lib $FindBin::Bin; 8 9 my ( $pager ); 10 11 $pager = "snafu-trash"; 12 13 unless ( open(OUT_PIPE,"| ${pager}") ) { 14 die("Can't open pipe to '${pager}' : $!\n"); 15 } # UNLESS 16 17 print "I should not be here !!!\n"; 18 19 print OUT_PIPE "line 1\n"; 20 print OUT_PIPE "2nd and last line\n"; 21 close OUT_PIPE; 22 23 exit 0; The output from my script was as follows Show quoted text
>>> pipe-bug.pl
I should not be here !!! 'snafu-trash' is not recognized as an internal or external command, operable program or batch file. As you can see the invalid open request was not trapped by the "unless" statement. I tried this same script on a Linux system and the error was properly trapped by the "unless" statement.
see perldoc.perl.org/perlport.html

"(Win32, RISC OS) Open modes |- and -| are unsupported."