in reply to munging function names with AUTOLOAD

I'm not sure if I fully understand your problem. You are saying that the line number reported is the same for each call, but that's not quite true. You get two line numbers, which is logical, because you create two subs: A::fancy and A::auto. If you want to get the line number for each invocation, and not for each first invocation (when the sub is stuffed in the stash), there's a simple fix. Put the call to caller inside the anonymous sub, and not inside the AUTOLOAD routine.

Abigail

Replies are listed 'Best First'.
Re: Re: munging function names with AUTOLOAD
by jimc (Sexton) on Jan 13, 2003 at 22:37 UTC
    that last paragraph was something of a red-herring, I almost edited it out, cuz it wasnt the core of the question. It was an artifact of my probing. The same-ness was between invocations of the same function, ie from main, of fancy() on lines 33, 34, and of auto() on 35, 36. I left it in cuz I wanted to preclude tips on closures.

    my real issue is how to compile methods at 1st invocation and still have name munging - so that fancy_33 and fancy_34 are both built (which I can do) and called from the respective points in the caller code (which eludes me).

    that said, closures may well be part of the answer, esp as they can capture all/most-of the customizations w/o client participation (ie args carrying the customization parameters) tia.