Another advantage of creating the app as a standalone app (like a common CPAN 
package) is that you will be able to use with another framework if Dancer will 
not be ready when it is ready, so you don't need to invest effort in the 
web-related part until you'll know that the web framework you want to use is 
good.

Plus that you will be able to create tests and you will be able to add command 
line scripts easier if you need them.

--Octavian

  ----- Original Message ----- 
  From: Andrew Solomon 
  To: Perl Dancer users mailing list 
  Sent: Thursday, January 23, 2014 5:47 PM
  Subject: Re: [dancer-users] Confused about types and globals


  On Thu, Jan 23, 2014 at 2:18 PM, Warren Young <[email protected]> wrote:

    Ideally, I want my top-level module to be as small as possible, doing 
little more than set up the route handlers, delegating all the real work to 
other modules.  To do that, I need to know where these objects come from, their 
exact data type, and which package's namespace they live in.  Then I'll know 
how to reference them or pass them around to the modules that do the work in my 
app.



  When you say "the modules that do the work in my app" I'm assuming you mean 
the model in an MVC architecture. If so, keep in mind that it's very difficult 
to maintain the code if you pass the route handlers' objects into the model's 
methods.


  An better approach is to implement the model separately from the Dancer DSL, 
giving it a command-line interface and unit tests. Once that's complete, call 
the model from the route handlers using data retrieved from the controller 
using calls like "params". This will make it much easier to identify bugs and 
make changes down the track - knowing that the impact is limited to the layer 
in which you're making the change/identifying the bug.




------------------------------------------------------------------------------


  _______________________________________________
  dancer-users mailing list
  [email protected]
  http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________
dancer-users mailing list
[email protected]
http://lists.preshweb.co.uk/mailman/listinfo/dancer-users

Reply via email to