本 网 站 在 Firefox 浏 览 器 中 显 示 最 佳
我们发布上海开源社区最及时的动态信息,
同时支持中国校园开源活动,
并且及时报道校园普及活动的最新动态。
最新信息
重点推荐
上海Drupal群09年第一次线下聚会
Submitted by editor on Tue, 01/06/2009 - 22:24.
上海Drupal群09年第一次线下聚会
这周六下午老时间、老地点,上海Drupal群第10次线下聚会
本次聚会主题继续延续前几次的Drupal6系列讲座,主要围绕
对该话题,对Drupal感兴趣的朋友们,欢迎来参加本次聚会。
聚会时间:09.01.10 星期六 下午13:30
聚会地点:上海市襄阳南路100弄10号(近南昌路)
地铁1号线陕西南路站/公交42/911/920/926
请发送报名邮件至peggy@raincitystudios.
详情请见:http://raincitystudios.
Peggy Xie- 谢培琪
Raincity Studios Inc.
Operation Coodinator - 商务助理
t. (021) 6445 9945
m. 136 3652 4787
e. peggy@raincitystudios.com
Raincity Studios, Inc.
100 Xiangyang Nan Lu, Bldg. 10 - 襄阳南路100弄10号
200031 Shanghai, China - 200031上海市,中国
www.raincitystudios.com
Popular Frameworks for Perl
Submitted by editor on Tue, 01/06/2009 - 13:46.
in
Perl has a large number of powerful frameworks for web development, some more actively used/developed than others. As with any technology choice you should review the documentation, check out the community (mailing list, irc channel, etc.) and ask lots of questions before choosing. This page makes an attempt to help you get started in that investigation.
Popular Frameworks
Popularity should never be the sole reason for choosing a technology, however more popular projects tend to have more docs, be more actively developed and have a larger community resource to learn from. The following frameworks (as far as this author knows) are being actively used and developed, and should be on the short‑list for any new Perl web development projects.
• Catalyst
• Community: http://dev.catalystframework.org/
• IRC: #catalyst on irc.perl.org
• Mailing List: http://lists.scsys.co.uk/cgi‑bin/mailman/listinfo/catalyst
• Jifty
• Community: http://jifty.org/view/HomePage
• IRC: #jifty on irc.freenode.net
• Mailing List: http://lists.jifty.org/mailman/listinfo
• Community: http://cgi‑app.org/
• IRC: #cgiapp on irc.perl.org
• Mailing List: http://www.erlbaum.net/mailman/listinfo/cgiapp
• WebGUI
• Community: http://www.webgui.org
• IRC: #WebGUI on irc.freenode.net
• Mailing List: http://www.webgui.org/webgui/dev/discuss
Other Frameworks
This is a list of other web frameworks out there, they are less well known, but may in fact be more what you want or need so worth at least taking a look at. Hopefully the authors of these frameworks will create linked wiki‑pages so that they can tell us more about what makes their framework unique.
• Gantry
• http://search.cpan.org/dist/Gantry/
• Community: http://www.usegantry.org/
• IRC:
• Mailing List: http://groups.google.com/group/gantry
• Egg
• http://search.cpan.org/dist/Egg‑Release/
• Maypole
• Solstice
• http://search.cpan.org/dist/Solstice/
• http://search.cpan.org/dist/ClearPress/
• http://search.cpan.org/dist/CGI‑Prototype/
• http://search.cpan.org/dist/Konstrukt/
• http://search.cpan.org/dist/Tripletail/
• MasonX::MiniMVC
• http://search.cpan.org/dist/MasonX‑MiniMVC/
• Rest::Application
• http://search.cpan.org/dist/REST‑Application/
• http://search.cpan.org/dist/Squatting/
• Mailing List: http://groups.google.co.uk/group/squatting‑framework
• IRC: #mojo on irc.perl.org
• Mailing List: http://lists.kraih.com/cgi‑bin/mailman/listinfo
Older Frameworks
Being in this list is not a bad thing, older frameworks (that are still around) are stable frameworks. However, that said, they may not be as up to date on current best practices. If the things listed above are not your style, give these oldies‑but‑goodies a look.
• Mason
• While Mason has framework pieces, it can also be used as just a templating engine inside another framework such as Catalyst or Jifty .
Advice on Choosing a Framework
Most of the popular/major frameworks support multiple templating (i.e. Template Toolkit or HTML::Mason) and class (i.e. Class::DBI, DBIx::Class or Rose::DB::Object) libraries, so this usually isn't a worry.
The main things to consider would be the level of support and matching it to your requirements ‑ there are several lightweight options such as CGI::Application or MasonX::MiniMVC, and more complex / powerful options such as Catalyst or Jifty ‑ next it's probably wise to see how the framework fits the problem ‑ can you make the solution fit well with an "opinionated" framework (i.e. Jifty), or do you need something more flexible (i.e. Catalyst).
There may already be an application that does what you want, without have to learn the low‑level details of a particular framework.
Building a bespoke Application Server
An alternative to using a ready made framwork would be to build your own using the new components being added to CPAN for handling specific jobs like dispatching, mod_perl /FastCGI support, etc.
• HTTP::Engine "An Application server to Web Application Framework gateway. inspired from python's WSGI and Ruby's Rack."
• HTTPx::Dispatcher
Comparisons
• Benchmarking 6 frameworks (with fastcgi and no acceleration or tuning)
• Another fcgi benchmark ‑ django vs catalyst
• Plat_Forms web development platform comparison
• MVC Marathon articles by Christopher H. Laco comparing building a web application using Catalyst, CakePHP, Django and Rails : introduction , part 1 , part 2 , part 3 .. more to follow
Articles
• Application Servers and Toolkits based on mod_perl ‑ Framework summary (along with templating and other resources)
• Rapid Web Application Development with Maypole ‑ Simon Cozens introduces Maypole
• Catalyst ‑ Jesse Shiedlower introduces Catalyst (with an explanation for its fork from Maypole)
• Rapid Website Development with CGI::Application ‑ Mark Stosberg gives a CGI::App update (with a brief comparison to Catalyst)
• Catalyst Compared ‑ A comparison table between CGI::App and Catalyst
• Hey, That's Pretty Jifty, er, Nifty ‑ Curtis Poe reviews Jifty (with a brief comparison to Catalyst)
• A Holiday Gantry Web Application ‑ Phil Crow demonstrates Gantry (with Bigtop and Tentmaker)
• The MVC Colouring Book ‑ Kirrily Roberts introduces MiniMVC
See Also
• ORM
To:
- editor's blog
- Login or register to post comments
Mojolicious+Template-toolkit+sqlite 例子
Submitted by blackjack on Sun, 01/04/2009 - 13:55.
in
这是在一个日本的例子上修改的,主要是改用Template-Toolkit 2 .
1)bbs.pm
package BBS;
use strict;
use warnings;
use base 'Mojolicious';
use MojoX::Renderer::TT;
use Template::Stash ;
# This method will run for each request
sub dispatch {
my ($self, $c) = @_;
# Try to find a static file
my $done = $self->static->dispatch($c);
# Use routes if we don't have a response code yet
$done = $self->routes->dispatch($c) unless $done;
# Nothing found, serve static file "public/404.html"
unless ($done) {
$self->static->serve($c, '/404.html');
$c->res->code(404);
}
}
# This method will run once at server start
sub startup {
my $self = shift;
# Use our own context class
# $self->ctx_class('BBS::Context');
my $tt = MojoX::Renderer::TT->build(
mojo => $self,
template_options => {
POST_CHOMP => 1,
PRE_CHOMP => 1,
STASH => Template::Stash->new,
INCLUDE_PATH => [ $self->home->rel_dir('templates')],
}
);
$self->renderer->add_handler(html => $tt);
# Routes
my $r = $self->routes;
# Default route
$r->route('/:controller/:action/:id')
->to(controller => 'example', action => 'welcome', id => 1);
}
1;
2)example.pm
package BBS::Example;
use strict;
use warnings;
use base 'Mojolicious::Controller';
use DBI;
use MojoX::Renderer::TT;
use Mojo::Log;
sub welcome {
my ($self,$c) = @_;
my $log_path = 'c:\tmp\bbs.log';
my $log = Mojo::Log->new(
path => $log_path,
level => 'debug',
);
my $path = 'c:\tmp\bbs.sqlite';
my $dbh = DBI->connect("dbi:SQLite:dbname=${path}",'','') or die $DBI::errstr;
$dbh->do(q{create table if not exists entries (id integer primary key,body varchar(255))}) or die $dbh->errstr;
if ($c->tx->req->method eq 'POST') {
my $body = $c->tx->req->params->param('body')||'';
if ($body){
my $sth = $dbh->prepare('insert into entries (body) values (?)') or die $dbh->errstr;
$sth->execute($body) or die $dbh->errstr;
}
my $res = $c->tx->res;
$res->code(302);
$res->headers->header('Location'=>$c->tx->req->url);
}else{
my $sth = $dbh->prepare('select id,body from entries order by id desc limit 30') or $dbh->errstr;
$sth->execute() or die $dbh->errstr;
my $rows = $sth->fetchall_arrayref({});
$log->debug("select * from entries");
my $url_for = $c->url_for;
$c->render(template => 'example/welcome.html', rows => $rows, action => $url_for );
}
}
1;
3)welcome.html
Mojolicious BBS!
Mojolicious BBS
-
[% FOREACH row IN rows %]
- [% row.id %] ***** [% row.body %]
[% END %]
通告
招募Linux开发人才
Submitted by blackjack on Mon, 11/24/2008 - 22:22.
in
我们计划以Fedora为基础,
- blackjack's blog
- Login or register to post comments
- Read more
CandyEye
Perl 6 to break compatibility, support other interpreters
Submitted by editor on Tue, 12/09/2008 - 10:26.
Enabling many more ways to obfuscate code
Version 6 of the popular Perl programming language will not be compatible with previous versions, but will open up a new world of custom “languages” and interpreters, according to its founder Larry Wall.
In Sydney for the annual Open Source Developers Conference, Wall delivered a keynore on “The once and future of Perl” and gave a few rare insights to what the future of Perl programming might look like.

