[Catalyst-commits] r8715 -
trunk/examples/CatalystAdvent/root/2008/pen
dhoss at dev.catalyst.perl.org
dhoss at dev.catalyst.perl.org
Thu Dec 4 18:47:38 GMT 2008
Author: dhoss
Date: 2008-12-04 18:47:38 +0000 (Thu, 04 Dec 2008)
New Revision: 8715
Modified:
trunk/examples/CatalystAdvent/root/2008/pen/AdventPhotoGallery.pod
Log:
fixed some corrections per review (thanks janus!)
Modified: trunk/examples/CatalystAdvent/root/2008/pen/AdventPhotoGallery.pod
===================================================================
--- trunk/examples/CatalystAdvent/root/2008/pen/AdventPhotoGallery.pod 2008-12-04 17:55:34 UTC (rev 8714)
+++ trunk/examples/CatalystAdvent/root/2008/pen/AdventPhotoGallery.pod 2008-12-04 18:47:38 UTC (rev 8715)
@@ -24,9 +24,11 @@
=item C<DateTime>
+=item C<Catalyst::Controller::HTML::FormFu>
+
=back
-Once you have installed these modules with great success, move on to the next step.
+Once you have installed these two things with great success, move on to the next step.
=head1 Let's get started already!
@@ -35,8 +37,9 @@
Create a controller in your application called Photos. Something like this:
+
perl script/*create.pl controller Photos
-
+
Next, you'll want to set up a table called Photos in your RDBMS of choice. Here, we use MySQL because I've yet to learn Postgres.
The necessary columns you will need are as follows:
@@ -83,6 +86,10 @@
=back
+Now, create your model:
+
+ ./script/myapp_create.pl model DB DBIC::Schema MyApp::Schema 'DBI:mysql:database=myapp' 'narf' 'blarf'
+
So now you have your basic tables set up. Next, we need to generate our Schema files so DBIx::Class can interact with our
database objects. I use this script to update/create my schema definition from the database.
Copy/paste this script into a file called myapp_update_schema.pl (replace "myapp" with whatever you named this application) and stick it
@@ -104,11 +111,12 @@
[ "dbi:mysql:myapp", "narf", "blarf" ]
);
+
now run perl script/*update*. If there are no errors, proceed!
=head2 Adding the InflateColumn::FS magic
-Open up Schema/Photos.pm. Since we used ::Loader, there will be a good portion of the file that you're not supposed to manually
+Open up lib/Schema/Photos.pm. Since we used ::Loader, there will be a good portion of the file that you're not supposed to manually
edit. This is marked by these lines:
# Created by DBIx::Class::Schema::Loader v0.04005 @ 2008-12-01 02:57:02
@@ -126,13 +134,14 @@
}
);
+
This tells DBIx::Class that the column "path" is now a Path::Class::File object and we can call Path::Class::File methods on it upon retrieval.
Great! Now let's edit our controller.
=head1 The Photos Controller
-Edit Controller/Photos.pm to match this file:
+Edit lib/Controller/Photos.pm to match this file:
package MyApp::Controller::Photos;
@@ -143,7 +152,7 @@
use Imager;
use MIME::Types;
use File::MimeInfo ();
- use BoyosPlace;
+ use MyApp;
__PACKAGE__->mk_accessors(qw(thumbnail_size));
@@ -358,9 +367,12 @@
}
}
+ 1;
-The view:
+
+=head2 The view:
+
=over 12
=item add.tt2
@@ -446,3 +458,4 @@
+
More information about the Catalyst-commits
mailing list