[CMI.PM] get function name?

Jay A. Kreibich jak at uiuc.edu
Thu Apr 21 08:41:35 PDT 2005


  Anyone know if there is a way to get the current function name?  For
  example:

----------------------------------------------------------------------

package myPkg;
use strict;

sub myFunc
{
	my( $f ) = ?????;

	# want $f equal to "MyFunc" or "myPkg::myFunc"
}

1;

----------------------------------------------------------------------

  With '?????' being some contant var reference or symbol (e.g. a
  built-in var or something like '__PACKAGE__'.

  With an autoloaded function this information is avaliable in
  $AUTOLOAD, but I was wondering if anyone knows how to extract this
  in the context of a normal package function and/or method.

   -j

-- 
                     Jay A. Kreibich | CommTech, Emrg Net Tech Svcs
                        jak at uiuc.edu | Campus IT & Edu Svcs
          <http://www.uiuc.edu/~jak> | University of Illinois at U/C


More information about the Champaign-Urbana mailing list