in reply to Re (tilly) 1: Short version of autoload
in thread Short version of autoload

I agree about not wanting to make a potentially tricky routine like this into Perl golf... though the title was short version of AUTOLOAD and it certainly lived up to that...

One minor thing; wouldn't you be better off doing a

goto &$field;
so that the call stack doesn't show the AUTOLOAD? After all, if you've created the subroutine, the AUTOLOAD isn't significant any more.

Replies are listed 'Best First'.
Re (tilly) 3: Short version of autoload
by tilly (Archbishop) on Jun 03, 2001 at 04:49 UTC
    It is traditional to put a goto there for exactly that reason. However this time I know it won't matter.

    Besides which a friend of mine demonstrated to me that jumping from sub to sub with goto could lead to a memory leak (he wrote a tail-recursive sub with a goto and after several runs with large argument lists ran out of memory) so I don't use that goto unless I really feel it is necessary for Perl to work correctly.

    I don't know if that bug has been reported to p5p yet. At the time I intended to check whether it still existed in a development version and then report it, but then I got busy...