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


Function_ID documentation  | view source Contained in the Function_ID distribution.

Index


NAME

Top

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

VERSION

Top

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

SYNOPSIS

Top

 use Function::ID;

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

Output:

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




DESCRIPTION

Top

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).

VARIABLES

Top

$this_function

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

$this_fn

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

EXPORTS

Top

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

 $this_function
 $this_fn




REQUIREMENTS

Top

 Carp.pm (included with Perl)




AUTHOR / COPYRIGHT

Top


Function_ID documentation  | view source Contained in the Function_ID distribution.