# New Ticket Created by Mark Overmeer
# Please include the string: [perl #81586]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=81586 >
(no detailed Perl -V information because the bug is on Windows which
I do not run... discovered by cpantesters)
The following script catches the die() used by Carp::confess. Only
on Windows, the $! get descroyed when confess is used with "\n".
#!/usr/bin/perl
use warnings;
use strict;
use Carp;
$SIG{__DIE__} = sub { print "@_: $! (rc=".($!+0).")\n" };
print "--> without \\n\n";
eval { $! = 3; confess "oeps" };
print "\n--> with \\n\n";
eval { $! = 3; confess "oeps\n" };
Output on all platforms except Windows (afaik) as expected:
--> without \n
oeps at /tmp/y line 10
eval {...} called at /tmp/y line 10
: No such process (rc=3)
--> with \n
oeps
at /tmp/y line 12
eval {...} called at /tmp/y line 12
: No such process (rc=3)
Output when run on Strawberry Perl 5.12.1.0 (x64) (and other
versions of Windows)
--> without \n
oeps at y line 10
eval {...} called at y line 10
: No such process (rc=3)
--> with \n
oeps
at y line 12
eval {...} called at y line 12
: (rc=0)
--
Regards,
MarkOv
------------------------------------------------------------------------
Mark Overmeer MSc MARKOV Solutions
Mark@Overmeer.net solutions@overmeer.net
http://Mark.Overmeer.net http://solutions.overmeer.net