| | | |
| The Bar and Comment models contain a 'editdate' an | | The Bar and Comment models contain a 'editdate' an |
| d 'postdate' field.. it would have been nice if i | | d 'postdate' field.. it would have been nice if i |
| could have some sort of 'pre save' hook to set it | | could have some sort of 'pre save' hook to set it |
| in the model once.. instead of in the Controller . | | in the model once.. instead of in the Controller . |
| . | | . |
| | | |
| But i haven't searched long enough for a solution | | But i haven't searched long enough for a solution |
| ... probably there is one ... somewhere.. | | ... probably there is one ... somewhere.. |
| | | |
t | | t | # Basic Steps
|
| | |
|
| | | (as outlined in the tutorial.. which i basicaly fo |
| | | llowed 1:1)
|
| | |
|
| | | - Create the project structure using a script
|
| | | - Create SQL tables (INCLUDING user table for auth |
| | | entication !)
|
| | | - Create your DBIx::Class schema files (perl files |
| | | ) - including user class !
|
| | | - "Autogenerate" the model class (only one .pm fil |
| | | e, does not contain anything .. except configurati |
| | | on for the database connection)
|
| | | - Implement application
|
| | | - List:
|
| | | - Create a simple controller method to fet |
| | | ch all Bars from DBIx::Clas
|
| | | - Create a template which displays them
|
| | | - Create:
|
| | | - Create a HTML::Widget by hand (you have |
| | | again to define all elements you want the form to |
| | | contain)
|
| | | - Add Validation constraints to those |
| | | elements
|
| | | - Add Filters explicitly (e.g. to HTML |
| | | Escape contents of text fields)
|
| | | - Create two controller methods: one to di |
| | | splay the form, one to process it
|
| | | - Loading data from the request into the H |
| | | TML::Widget is automated, as is the validation (on |
| | | e line of code - does not work for n:m relations, |
| | | this has to be done manually)
|
| | | - If no errors happened, you can populate |
| | | the values into your model automatically
|
| | | - Create a template which simply outputs w |
| | | hat HTML::Widget returns.
|
| | | - Delete:
|
| | | - create a simple controller method with o |
| | | ne line of code
|
| | | - Edit:
|
| | | - Same as 'Create', except that you 1. nee |
| | | d to load the model, 2. fill the model values into |
| | | the form (this is one line of code, the reverse o |
| | | f 'populate' - it seems that this does NOT work wi |
| | | th n:m relations)
|
| | | - Edit requires two extra methods (this is |
| | | at least what the tutorial makes me believe.. alt |
| | | hough i'm sure it's possible to combine them) - wi |
| | | th 99% the same code as 'Create'
|
| | | - Comments: I was to lazy to create another fo |
| | | rm - i simply created a POST form and a controller |
| | | method to store the comment. nothing more.
|
| | |
|
| # Code Examples | | # Code Examples |
| | | |
| ## Controller | | ## Controller |
| | | |
| TODO | | TODO |