MVCimple - An easy data model framework for Perl. It puts the "M" in "MVC"!
MVCimple is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
MVCimple is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with MVCimple. If not, see <http://www.gnu.org/licenses/>.
MVCimple is a data framework designed to automate many common tasks that database-backed web applications perform. Although it includes some basic templating features, MVCimple was designed to be paired with front-end frameworks like Mojolicious to create full Model-View-Controller type applications.
Database Driven
MVCimple models are designed to be stored in a relational database. The framework leverages database constraints like foreign keys to build relationships between objects and build smarter input widgets.
Validation of User Input
MVCimple model objects know their own constraints and are easily validated with built-in methods. Validation is done automatically before any database interaction, preventing data errors and SQL injection attacks.
SQL Generation
MVCimple dynamically generates SQL code from model definitions, so you don't have to!
Widget generation MVCimple can generate input widgets for its included datatypes, making it easy and quick to design forms for user input. Widgets are aware of objects' constraints and come with Javascript methods to do client-side validation, catching problems before the server has to. "Smart" widgets are automatically generated for foreign keys and enum-type data models.
Templating
MVCimple contains a simple template engine that is based on standard HTML. MVCimple model objects can also be used with other template engines to get even more functionality. They also dump cleanly to XML to harness the power of XSLT.
MVCimple is a lightweight web application framework for Perl. It is currently focused on automating the data manipulations of applications, providing easy interfaces to create data objects, turn them into forms, validate user input, and return error messages to the user.
Although it contains features like templating, MVCimple is really intended as a complement to other frameworks like Mojolicious. You can write a complete application using MVCimple's built-in template engine, use MVCimple objects in a Mojolicious::Lite application to take advantage of fancy routing, or anything in between. It's Perl - there's more than one way to do it!
MVCimple is still under heavy development, so please leave comments and issues if you find them.
The included "Hello World" sample is a Mojolicious::Lite application that uses MVCimple to handle interaction with a SQLite database. It demonstrates the important features of MVCimple and uses XSLT for templating.
MVCimple is designed to make strict applications with a very short list of dependencies. The following core dependencies should be included in the standard Perl distribution:
To use some fancier features (like automated unit tests), you'll also need:
In addition to Perl dependencies, generated forms rely heavily on Jquery and JqueryUI for a dynamic user experience.
MVCimple applications should have something like the following directory structure
+MyApp
|
|--lib
| +
| |-- MVCimple
|
|--web
|
|--conf
| +
| |-- app_config.conf
When using a webserver like Apache, the <DocumentRoot> of the application should be /path/to/MyApp/web
. The lib/MVCimple/
directory can be a symbolic link to a common installation of MVCimple, if that is desireable.
At the core of any application are the data models that define what data are stored and how they are related to one-another. MVCimple uses XML files to define data models and then automatically generates views and controllers for them.