CatalystX::CRUD::Tutorial is a step-by-step through CatalystX::CRUD example app.
OVERVIEW
The goal of the CatalystX::CRUD project is to provide a thin glue between your existing data model code and your existing form processing code. The ideal CatalystX::CRUD application actually uses very little Catalyst-specific code. Instead, code independent of Catalyst does most of the heavy lifting. This design is intended to (a) make it easier to re-use your non-Catalyst code and (b) make your applications easier to test.
This tutorial is intended for users of CatalystX::CRUD. Developers should also look at the CatalystX::CRUD API documentation. We will look at two of the CatalystX::CRUD implementations: the Rose::HTML::Objects controller (CatalystX::CRUD::Controller::RHTMLO) and the Rose::DB::Object model (CatalystX::CRUD::Model::RDBO). Note that these two modules are available on CPAN separately from the core CatalystX::CRUD package.
Create a new Catalyst application
% catalyst.pl MyApp
...
% cd MyApp
Make a directory structure to accomodate the classes we'll be creating:
% mkdir lib/MyCRUD
% mkdir lib/MyCRUD/Album
% mkdir lib/MyCRUD/Song
Create a database
This tutorial will assume SQLite as the database, but any RDBO-supported database should work. You might need to tweek the SQL below to work with your particular database.
/* example SQL file to init db */
create table albums
(
id INTEGER primary key,
title varchar(128),
artist varchar(128)
);
create table songs
(
id INTEGER primary key,
title varchar(128),
artist varchar(128),
length varchar(16)
);
create table album_songs
(
album_id int not null references albums(id),
song_id int not null references songs(id)
);
insert into albums (title, artist) values ('Blonde on Blonde', 'Bob Dylan');
insert into songs (title, length) values ('Visions of Johanna', '8:00');
Save the above into a file called mycrud.sql and then create the SQLite database:
% sqlite3 mycrud.db < mycrud.sql
Test your database by connecting and verifying the data:
% sqlite3 mycrud.db
SQLite version 3.1.3
Enter ".help" for instructions
sqlite> select * from songs;
1|Visions of Johanna||8:00
sqlite> .quit
Now you are ready to write some Perl.
Product's homepage
Requirements:
· Perl