Catalyst学习

#perl -MCPAN -e shell
install Catalyst
install Bundle::CPAN
install Bundle::LWP
install Bundle::DBD::mysql mysql_config需要在PATH中
force install Template BSD5.5 Perl5.8.8需要forceinstall
install DBIx::Class
install DBIx::Class::Schema
install DBIx::Class::Schema::Loader
install Crypt::CBC
install Crypt::CAST5_PP
install Task::Catalyst 在BSD5.5 Perl5.8.8下,似乎要重复运行两次才可以
 
install Catalyst::Plugin::Session
Session的支持,似乎需要独立安装
install Catalyst::Plugin::Session::State::Cookie
install Catalyst::Plugin::Session::Store::FastMmap
 
完成开发环境安装:)
第二步,生成开发环境
catalyst.pl mywebsite
cd mywebsite
script/mywebsite_create.pl VIEW TT TT
 
第三步,修改lib/mywebsite.pm,增加Session的支持
use Catalyst qw/-Debug
ConfigLoader Static::Simple
Session Session::Store::FastMmap Session::State::Cookie /;
加入end处理TT
sub end : Private {
my ($self, $c) = @_;
unless ($c->res->body()) {
$c->res->header("Content-Type" => "text/html; charset=gb2312");
$c->forward("mywebsite::View::TT");
}
}
 
生成数据库支持
script/mywebsite_create.pl model AutoDB DBIC::Schema AutoDB create=static "dbi:mysql:database=auto;mysql_socket=/tmp/mysql.sock" "root" ""
 
使用$c->model("ModelName::TableName")来访问数据库
 

你可能感兴趣的:(mysql,数据库,session,schema,perl,Class)