On Fri, 2 Jan 2009, David Ihnen wrote:
> Mark Hedges wrote: > > I wonder how easy it would be to add controller > > subroutine attributes for which ones are allowed or not, > > ala Catalyst, instead of the controller having to > > provide an 'allowed_methods' method. > > > > It would have been nicer as a dispatching framework if it > either A. would instantiate my object (through a defined > interface like ->new($server)) first THEN call the method > or B. defined a hook-handle/decline interface not that > different from apache so that I can custom define how you > check for availability (rather than the :public list or > ->can), instantiate if relevant, and call subroutines in > my particular object. > > I guess I'm saying consider the interface flexibility as > you design the framework - there may be interest in doing > something in the realm of setup before calling the method. I see. I guess that was something like my original thought of making you provide allowed_methods() which returns an array. It's not much harder to type than :public everywhere, gives you a central list ("which methods are allowed?" is easier to answer from looking at the top of the package), gives you flexibility/dynamism/inheritance, and the results get cached by Apache2::Controller::Funk in a lookup hash. So I will probably stick with requiring allowed_methods() in the controller package instead of inventing an elaborate mechanism to make this "easier." Thanks for your input. Mark