Basically most of the actual perl code you write won't display anything, it will just set variables in the stash, and your template files (in root) will display those variables.
The Intro in the Catalyst manual is pretty good:http://search.cpan.org/dist/Catalyst-Manual/lib/Catalyst/Manual/ Intro.pod
Tons of info on the Catalyst Wiki (some of it out of date): http://dev.catalystframework.org/wiki Tons of example code here: http://dev.catalystframework.org/browser/trunk/examples Another handy example: http://www.herlpacker.co.uk/tech/development/projects/parley/ And this is fun: http://search.cpan.org/search?m=all&q=Catalyst+PluginWhen I was learning TT, it took me a while to realize that the docs weren't in the Template pod, it was in the Template::Manual::* pod docs:
http://search.cpan.org/dist/Template-Toolkit/lib/Template/Manual/ Intro.pod http://search.cpan.org/dist/Template-Toolkit/lib/Template/Manual/ Syntax.pod
For PHP-style parameter arrays, take a look at Catalyst::Plugin::Params::Nested:
<input name="search[name]" />
<input name="search[address]" />
turn into a hashref you can pass around, or access directly:
my $foo = $c->req->param('search');
$foo->{name};
$foo->{address};
This is really nice when you want to do something like this:
sub search : Local {
my ($self, $c) = @_;
$c->stash->{results} = $c->model('Something')->search(
$c->req->param('search')
);
}
which will basically connect to the database, do a "SELECT * FROM
some_table WHERE name = '<form input>' AND address = '<form
input>'", grab the results, stick them in the stash, and then it's
off to your template (named search.tt by default since the sub is
called "search") to display. Of course, in the real world you
probably want to check the input a little more stringently, but
DBIx::Class does prevent quite a few SQL-injection type attacks by
using something called binding... anyway, I'm getting off the subject.
Hope that helps you get started. On Dec 29, 2006, at 12:06 AM, Brian wrote:
Thanks for the quick reply. Very helpful and encouraging.What is the best way to go from PHP to Catalyst? I used to program in Perl, so I'll learn / remember that fast.Are there any open source applications running on Catalyst / TT that I could install and poke around in to get a feel for it?Any tutorials or introductions that were helpful for you, or that you wish you had when you made the transition?I really appreciate the feedback and direction. Thanks, Brian
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ List: [email protected] Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
