Interrupting the program below with Ctrl + C causes a "Segmentation fault" with perl 5.10.0. It works correctly with perl 5.8.8. Any idea why?
#!/usr/bin/perl
# just changing the shebang line to use perl 5.10.0 causes it to seg fault
# when interrupted with Ctrl + C
use strict;
use warnings;
$SIG{INT}=\&clean;开发者_高级运维
sub clean {
print 'caught';
}
sleep 10;
(program taken from Problem with perl signal INT)
The perl 5.10 version is:
$ perl5.10.0 -v
This is perl, v5.10.0 built for i686-linux-thread-multi
(with 3 registered patches, see perl -V for more detail)
Copyright 1987-2007, Larry Wall
Binary build 1002 [283697] provided by ActiveState http://www.ActiveState.com
Built Jan 10 2008 07:35:18
...
The linux distribution:
$ cat /proc/version
Linux version 2.6.18-128.7.1.el5 (mockbuild@hs20-bc2-3.build.redhat.com)
(gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)) #1 SMP Wed Aug 19 04:00:49 EDT 2009
Thanks
You're going to need to provide some more details, such as what operating system/version you are using, whether you're using system perl, perlbrew, active perl, etc. Trying this against Perl 5.12.3 built from Perlbrew on Snow Leopard, I cannot reproduce the issue.
I would also follow the suggestion of asking on perlmonks.org, too.
精彩评论