Subject: | make sig_name()/sig_num() accept both numbers and names |
This is a request from zefram at fysh dot org:
Date: Wed, 26 Jan 2005 22:38:38 +0000
To: roderick@argon.org
Subject: IPC::Signal and polymorphism
Message-ID: <20050126223838.GA9994@fysh.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.3.28i
In writing signal-handling functions in Perl, it becomes annoying that
there are two common forms in which signal identities are represented:
the numbers and the names. Different Perl functions require different
forms, and of course that's what IPC::Signal is there to help with.
But I'd prefer to avoid propagating this annoyance through the
signal-handling functions that I write. I'd like to make my functions
polymorphic, accepting either a signal number or name, whichever is
more convenient for the caller. In order to do this, it would be
really helpful to have a function that accepts a signal number-or-name
and returns a signal number, and a function that accepts a signal
number-or-name and returns a signal name. These would, of course, be
polymorphic versions of sig_num() and sig_name(). Therefore I propose
that sig_num() and sig_name() in IPC::Signal should behave in that way,
accepting either numbers or names.
If sig_num() and sig_name() behaved like that, then a lot of signal
handling code would instantly become polymorphic in the manner that I
propose, without any effort on the part of its author. I think this
would be a nice bit of DWIMery. What do you think?
-zefram