Why "use 5.005;" have side effects?

This snippet behaves differently depending on whether use 5.005;(or any other version) is present .

Why?

I have not seen anything suspicious in perldoc -f use.

#!/usr/bin/perl -w
use strict;

# If this is present, "Exiting\n" is printed, but the process doesn't exit.
# If commented out, exit terminates this process.
# Go figure
use 5.005;

# Open a sub-process that is "long-lived".
open FH, 'perl -e "sleep 600" |'
    or die $!;

$SIG{ALRM} = sub {
    print "Exiting\n";
    exit;
};
alarm(1);

<FH>;

Tested on ubuntu 12.04 perl version 5.14.2 and debian perl version 5.10.1

PS: I'm not looking for a workaround, but an explanation.

+4
source share
1 answer

I cannot reproduce this behavior using Perl 5.18 on Fedora 20. So this is a bit of a shot in the dark.

, , Perl (" , , $? ${^CHILD_ERROR_NATIVE}).

" " , , Perl . , , . , - .

+2

Source: https://habr.com/ru/post/1525175/


All Articles