in reply to Is the signal handler supposed to work like this?

Eureka!

Look at this code -- it works without threads! So, threads aren't the magic here.

#!perl -w use strict; print "Enter CTRL-C to end input\n"; $SIG{INT} = 'IGNORE'; my @rv = <STDIN>; eval q/$SIG{INT} = 'DEFAULT'/; chomp @rv; print "Enter CTRL-C to exit\n"; while ( 1 ) { local($") = ', '; print "You entered: @rv\n"; sleep(1); }
Is another Perl interpreter instance being launched to handle that eval()? Or is the first instance looking for all of the places that twiddle %SIG, and evaluating them upfront? Perhaps there are only a handful of things (like spawning a thread or calling eval()) can get the Perl interpreter to push the state of %SIG down into the operating system?

Thoughts on just what the mechanics are behind this behavior?