AUTOLOAD considered harmful (why not just generate all the methods you
need?)
In most cases, I would agree with you about creating explicit methods
(including a generic method with parameters for the "unknown at coding time"
elements). However, for my current project, I have made a conscious design
decision to go with an AUTOLOAD (or AUTOMETHOD) solution, as I considered
the benefits to outweigh the alternatives. Code readability is one of those
benefits in my case.
I'm not exactly sure what the arguments for "AUTOLOAD considered harmful"
are, but I do believe that AUTOLOAD's use should be limited and with
responsibility.
But if you really want to, there's a role for this already:
http://search.cpan.org/~logie/MooseX-Role-MissingMethodUtils-0.02/lib/MooseX/Role/MissingMethodUtils.pm
I knew somebody would know of something like this. However, looking at the
documentation at link, I'm not entirely convinced it is the same thing as
AUTOMETHOD. It's hard to tell.
Anyway, thank you for the feedback.
- Esjs