PerlMVC


DanielAllen has a database/web project which might be easily done using a MVC framework. He'll be looking at Maypole as a first go at making things work.

What's MVC?

  • MVC stands for Model View Controller. It is a framework for database-backed computer applications, including web applications.
  • One possibly incorrect way of thinking about it is a grand-child of the (1960s) framework of "input -> process -> output".
    • If you reshape your thinking so: all three are object-oriented and completely independent of each other; and any particular Model, View, or Controller can be swapped out for another in its place, then:
      • Model == processing stage
      • View == output stage
      • Controller == input stage

It's a simplistic analogy because input/process/output predates event-driven programming or object-orientation, but it might be useful.

How does maypole fit with MVCs?

  • Model: currently only written with Class::DBI and its helper-packages
  • View: Template Toolkit or Embperl or ...
  • Controller: works with mod_perl or straight CGI under apache.

Conclusions

  • In an hour's documentation reading and a quick installation (see http://maypole.perl.org/?LinuxInstall), I could then revise the standard beer DB example to do approximately 80% of what I needed my application to do.
  • Another 10% took another few hours (fiddling with the Model so it reported the proper data relationships; I'm still not sure how to do many-to-many lookups).
  • The remaining 10% would be much easier if I had the new O'Reilly Template Toolkit book.
  • Since it's based on Class::DBI, it won't be able to easily handle inheritance between classes, or perhaps other complex data relationships. (examples? counter-examples?)
  • I'd love to know more about Catalyst. And Ruby on Rails. And Struts.

References

http://maypole.perl.org/?ManualAbout

http://dev.catalyst.perl.org/wiki/MoreFAQ