The following module was proposed for inclusion in the Module List:
modid: Function::ID
DSLIP: bdprp
description: Variables to let functions know their names
userid: ROODE (Eric J. Roode)
chapterid: 20 (Control_Flow_Utilities)
communities:
comp.lang.perl.modules
similar:
None that I know of... but I can't claim to have searched
exhaustively.
rationale:
This is an exceedingly simple module. It ties two variables and
places them in the caller's namespace. When used, these variables
contain the name of the function that uses them. One variable just
contains the function name, the other includes the function's
package. Example:
use Function::ID; sub foo { print "This is $this_function\n"; print
"Also known as $this_fn\n"; }
This will print:
This is main::foo Also known as foo
It seems to me that this is a useful shortcut for error or log
messages, and possibly for debug messages. You can copy/paste an
error message from one function to another, and you don't have to
worry about changing the text of the message to reflect its new
place in the program.
I suggested this module on comp.lang.perl.modules about a week ago,
and the response was positive. I did a search around CPAN and didn't
find any similar modules. I did see that a top-level Function:: name
exists, and I think that this module logically fits under that name.
However, I'm not wedded to the name "Function::ID"; I'm open to
changing it if someone has a better suggestion or if there's a
problem with that place in the hierarchy.
Thanks, Eric
enteredby: ROODE (Eric J. Roode)
enteredon: Sun Mar 30 03:49:19 2003 GMT
The resulting entry would be:
Function::
::ID bdprp Variables to let functions know their names ROODE
Thanks for registering,
--
The PAUSE
PS: The following links are only valid for module list maintainers:
Registration form with editing capabilities:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=f9400000_9057c0b12823cb9f&SUBMIT_pause99_add_mod_preview=1
Immediate (one click) registration:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=f9400000_9057c0b12823cb9f&SUBMIT_pause99_add_mod_insertit=1