in reply to Sub on the fly?

I admit I'm confused... How is what you want different than the functionality AUTOLOAD provides?

---
It's all fine and dandy until someone has to look at the code.

Replies are listed 'Best First'.
Re^2: Sub on the fly?
by stvn (Monsignor) on Aug 17, 2006 at 11:59 UTC

    Well to start with, perl's method dispatch will first look for an inherited method, then go to AUTOLOAD, so if the OP wants to override a method locally they could not do this with AUTOLOAD.

    Also, using AUTOLOAD has a signifigant performance hit, which depending on the complexity of your AUTOLOAD function can easily be something like 4x slower. Not to mention the programmer complexity hit, even the simplest AUTOLOAD function is harder to understand and reason about then a set of simple methods.

    IMO, AUTOLOAD should be a last resort for when you really don't know the names of the methods to be called, and not a tool for reducing typing.

    -stvn