This seems like a well thought-out idea, but unfortunately I think it shouldn't be done. Dancer 2 is already completely OO and so is the DSL. The idea now is to simply keep Dancer 1 maintained as far as to let Dancer 2 be developed continually. Once Dancer 2 is ready, we'll start moving to it. It will already contain all the things people suggest to put into Dancer 1, being done more cleanly and correctly. 2012/1/26 Роман Галеев <ip@ncom-ufa.ru>
Simple Dancer OO approach.
The idea is simple -- we need to defer route handler declaration. It could be done with re-definition Dancer DSL words like get, post, any, etc. It's done in Dancer::OO::Dancer module.
Deferred declarations are stored in package _handler array variable.
This approach allows to define and use common handlers and to write extendable modules that could be mounted to later declared uris.
To use this deferred technique package must be inherited from Dancer::OO::Object package, which sole purpose is to install deffered handlers. It does so by building inheritnance tree and calling Dancer::* methods with obvious alterations.
Handlers are installed to prefixed routes, thus limiting the route syntax to simple strings.
I've included a sample Sample application, which has common Sample::Base for Sample::Root and Sample::Demo packages.
https://github.com/jamhed/Dancer-OO
-- With best regards, Roman Galeev _______________________________________________ Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users