View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Eric J. Roode > Function_ID > Function::ID



Annotate this POD

View/Report Bugs
Module Version: 0.02   Source  


Function::ID - Variables to let functions know their names.


This documentation describes version 0.02 of Function::ID, March 29, 2003.


 use Function::ID;
 sub your_routine {
     print "Hi, I'm $this_function, or $this_fn for short!\n";


 Hi, I'm main::your_routine, or your_routine for short!


This module provides two tied variables, $this_function and $this_fn, which when invoked contain the name of the function they're being used in. In other words, they return the identity of the function that uses them. This can be useful for log, error, or debug messages.

Both these variables contain undef in the main portion of a program's code (ie, outside of any function body).



$this_function returns the fully-qualified name of the current function, including its package. For example: 'Foo::Bar::Baz::my_function'.


$this_fn returns the name of the current function, with no package name. For example: 'my_function'.


This module exports the following symbols into the caller's namespace:


REQUIREMENTS ^ (included with Perl)


Eric J. Roode,

Copyright (c) 2003 by Eric J. Roode. All Rights Reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

If you have suggestions for improvement, please drop me a line. If you make improvements to this software, I ask that you please send me a copy of your changes. Thanks.

syntax highlighting: