Catalyst is just another MVC framework. This page contains contents non-Catalyst, e.g. CSS, AJAX, etc.
Profiling
Catalyst::Stats
Get alternating rows in a table with TT2 and CSS
Use filters in TT2
define filters in MyApp::View::TT.pm
__PACKAGE__->config({
...
FILTERS => {
'floatprint' => [sub {sprintf "%6.3f", @_;}],
}
});
use it in the template,
[% temp.temp00 FILTER floatprint %]
Debug
$c->log->info("Starting the foreach loop here");
$c->log->debug("Value of $id is: ".$id);
Catalyst setup on Windows
http://www.shadowcatsystems.co.uk/static/cat-install
need nmake and a C compiler (from such as Dev-C++)
Catalyst test
run MyApp_server.pl with "-r" when testing for auto-restart when file is modified
mod_perl2 and Catalyst on Windows
mod_perl2 can be installed using ppm, this can be easily found.
to setup mod_perl work with Catalyst, some example can be found here. don't forget to get Catalyst::Engine::Apache.
part of the httpd.conf file:
PerlSwitches -IG:\temp\X\lib
LoadFile "C:/Perl/bin/perl58.dll"
LoadModule perl_module modules/mod_perl.so
PerlModule X
<Location />
SetHandler modperl
PerlResponseHandler X
</Location>
suppose G:\X\lib\X.pm being the Catalyst application.
Tutorials
- Catalyst::Manual::Tutorial
- Catalyst::Example::InstantCRUD
- http://dev.catalyst.perl.org/wiki/YetAnotherCatalystIntro
- http://www.pjls.co.uk/tutorials/catalyst.html
create m/v/c
script/myapp_create.pl controller Books
script/myapp_create.pl model MyAppDB DBIC::Schema MyAppDB dbi:SQLite:myapp.db '' '' '{ AutoCommit => 1 }'
script\myapp_create.pl view MyChartStrip Chart::Strip
use regular expressions in the controller
sub monRun : LocalRegex('^mon(\d+)') {
my ( $self, $c ) = @_;
my $RUN = $c->req->captures->[0];
#$c->response->body("captured $RUN");
}
css reference
http://www.w3.org/TR/REC-CSS1 http://www.w3.org/TR/REC-CSS2generate schema automatically
perl -MDBIx::Class::Schema::Loader=make_schema_at,dump_to_dir:./lib \
-e 'make_schema_at("SpinDBSchema", { debug => 1 }, [ "dbi:Pg:dbname=spin_scratch"])'
TTSite
ttsite.css and tt2 files for the views are at root/src, layout, header, footer, etc are found at root/lib/site/, sitewide data can be defined in are in root/lib/config/main
memcached
http://www.danga.com/memcached/
HTML Reference
http://htmlhelp.com/reference/html40/
JS and DOM reference for gecko
http://developer.mozilla.org/en/docs/Gecko_DOM_Reference
AJAX in view
http://search.cpan.org/~esskar/HTML-Prototype-1.48/lib/HTML/Prototype.pm
http://code.google.com/webtoolkit/
some simple examples: http://24ways.org/2005/edit-in-place-with-ajax
benchmarking
ab -n 100 -c 10 localhost/page?param=value
host
right now I'm using Catalyst on Linux with Postgres/Apache2/mod_perl
lighttpd and fastcgi seems to be quite common too:
http://www.dev411.com/wiki/Installing_lighttpd_and_FastCGI_for_Catalyst
javascript, etc
http://extjs.com/deploy/ext/docs/
very nice tutorial on extjs data grid:
http://www.catalystframework.org/calendar/2007/9
Inspect DOM, debugging CSS/JS/HTML, monitor network, etc:
ExtJS
http://extjs.com/deploy/dev/docs/
Editor grid example
http://extjs.com/forum/showthread.php?t=18435
Reference
http://www.mail-archive.com/catalyst@lists.rawmode.org/info.html