develooper Front page | perl.perl5.porters | Postings from February 2003

Re: [PATCH] $SIG::UNSAFE

Thread Previous | Thread Next
From:
Jarkko Hietaniemi
Date:
February 23, 2003 07:16
Subject:
Re: [PATCH] $SIG::UNSAFE
Message ID:
20030223151545.GA26630@kosh.hut.fi
On Sun, Feb 23, 2003 at 06:37:28AM -0800, Gurusamy Sarathy wrote:
> On Sun, 23 Feb 2003 14:45:06 +0200, Jarkko Hietaniemi wrote:
> >Here's a patch for enabling in runtime the Old Way Of Signals.
> >After much waffling I settled on the $SIG::UNSAFE name for the
> >control variable, which (I think) falls at the right balance of
> >backward portability, least danger of stomping on a user variable,
> >and aesthetics.
> 
> Not having looked at the patch, $SIG::UNSAFE doesn't seem all
> that consistent to me.  Is there a precedent for this style
> of setting a flag?
> 
> IOW, why not C< ${^UNSAFE_SIGNALS}++ >?

We have been through all the possible namings (I think...)
Please read the p5p threads (I think it was "safe signal safe tests").

${^FOO} don't work for old Perls (the whole point being
helpings backward compatibilities).

The alternative way of writing ${^FOO} as ${^"\cFOO"} does
not work with local() because Perl thinks that the latter syntax
is a symbolic reference.  (Not to mention that $^{"\c is quite
a mouthful.)  Using local() to temporarily switch in the old
signal behaviour was one of the main planned uses for the features.

> Or even better yet C< $SIG{__ALL__} = 'IMMEDIATE' >?  This could
> be extended in future to allow more specific behaviors:
> C< $SIG{ALARM} = 'IMMEDIATE' >.

While I like the syntax $SIG{__FOO__} does not work with -w since
we have (had for a long time) a warning for unknown signals.

No 'no warning' to get rid of the warning since again, backward
compatibility is the primary reason for this whole dance.  I guess
we *could* go for the recipe

	local $^W = 0;
	local $SIG{__ALL__} = ...;

but that runs against another snag with old Perls and using
new metaentries in %SIG: localizing hash elements leaves the
keys hanging in the hash at the scope exit.

> C< $SIG{__ALL__} = 'IGNORE' > would of course disable signal
> handling altogether, which is something one may want to do
> when executing unsafe code or when creating threads or when
> running embedded in another application.
> 
> Just a thought.

-- 
Jarkko Hietaniemi <jhi@iki.fi> http://www.iki.fi/jhi/ "There is this special
biologist word we use for 'stable'.  It is 'dead'." -- Jack Cohen

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About