[ CCed to [EMAIL PROTECTED] ]

On Wed, Jun 18, 2003 at 06:43:24AM -0700 Rob Richardson wrote:

> Interesting!  Not that I can understand much of it...
> 
> But I'm particularly interested in the caller stack.  Is that standard
> Perl or do I have to have a special module?

caller() is a Perl-builtin. See 'perldoc -f caller'. In a nutshell: It
can be used to figure out by whom a function (or a module included with
require()) was called. For instance, a function can find out its own
name programatically:

    sub test1 { test2(); }
    sub test2 { print "My name is ", (caller(0))[3], 
                      " and I was called by ", (caller(1))[3], "\n"; }
    test1();
    __END__
    My name is main::test2 and I was called by main::test1

These are usually pretty exotic information but if you want to write
your own debugger, you'll have use for it.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to