Perl--Mojolicious web框架学习

2650阅读 0评论2013-06-27 oceanswimmer
分类:Python/Ruby

Site
    
    perldoc
Modules
    Mojolicious:Lite    #micro real-time web framework built around Mojolicious.
Tool
    /home/work/opstools/autopush/dev/autopush/lib/mojo/bin/morbo    #build in development webserver

简单程序HelloWorld

    1. , , and Perl 5.10 features are automatically enabled and a few functions imported when you use Mojolicious::Lite
    2. 支持修改后立即生效,无需重启
    3. 启动; morbo helloworld.pl -l http://*:PORTNUM 或 perl helloworld.pl -l http://*:PORTNUM
  1. #!/usr/bin/perl
  2. use warnings;
  3. use strict;
  4. use lib qw{
  5. /home/work/opstools/autopush/dev/autopush/lib/mojo/share/perl5
  6. /home/work/opstools/autopush/dev/autopush/lib/timehire/lib64/perl5/
  7. };
  8. use Mojolicious::Lite;

  9. get '/' => sub {
  10.         my $self = shift;        #$self : a Mojolicious::Controller object containing both the HTTP request and response.
  11.         $self->render(text => 'Hello World!');
  12. }; 
  13. app->start;
  14. get '/' => {text => 'Hello World!'};
自动生成web目录结构
  1. mojo generate lite_app myliteapp    #plugin, app, lite_app, makefile多种选择


    

上一篇:019-case for while until
下一篇:没有了