<div dir="ltr">Hi all,<div><div>  I get the sense that we are using Main.pm very poorly and a bit of Dancer2 architectural insight would greatly improve the quality of our code.</div><div><br></div><div>What is the best pattern for the breakdown between perl module/Dancer2 route handler/TT file?</div></div><div><br></div><div>For example, if you have a sub-system for administrators that manages the fees tables and reports, would you put these into separate route handlers?</div><div>eg.</div><div>ReportsHandler.pm => Route handler for reports</div><div>- Instantiates an instance of Reports.pm in it's "before" hook so we only need to do this once (or in the module itself?)</div><div>- the 'view' and 'save' routes call the appropriate 'get' and 'set' methods for that table in Reports.pm</div><div><br></div><div>and a separate handler for Fees, with an overarching Main.pm route handler that largely deals with mainstream userspace routes (any significant user workflows get their own router handler module like ReportsHandler and FeesHandler)?</div><div><br></div><div>Ideally, I'd like all our code in the perl modules, with the route handler doing nothing but dispatch (with error handling) and the TT doing basic interface presentation.</div><div>But at the moment, each route handler is 20-30 lines long - I think they should be ~5 lines long or less.</div><div><br></div><div>An exemplar Main.pm + TT file would be very helpful!</div><div><br></div><div>cheers,</div><div>Nathan</div></div>