yappoの日記

 | 

2008-06-18

no context branch

19:35

old style.

use strict;
use warnings;
use HTTP::Engine;
my $engine = HTTP::Engine->new(
    interface => {
        module => 'ServerSimple',
        args   => {
            host => 'localhost',
            port =>  1978,
        },
        request_handler => sub {
            my $c = shift;
            $c->res->body('hello');
        },
    },
);
$engine->run;

old style with Declare.

use strict;
use warnings;
use HTTPEx::Declare;

interface {
    module => 'ServerSimple',
    args   => {
        host => 'localhost',
        port =>  1978,
    }
};

run {
    my $c = shift;
    $c->res->body('hello');
};

new style.

use strict;
use warnings;
use HTTP::Engine;
use HTTP::Engine::Response;
my $engine = HTTP::Engine->new(
    interface => {
        module => 'ServerSimple',
        args   => {
            host => 'localhost',
            port =>  1978,
        },
        request_handler => sub {
            my $req = shift;
            HTTP::Engine::Response->new( body => 'hello' );
        },
    },
);
$engine->run;

new style with Declare.

use strict;
use warnings;
use HTTPEx::Declare;
use HTTP::Engine::Response;

interface {
    module => 'ServerSimple',
    args   => {
        host => 'localhost',
        port =>  1978,
    }
};

run {
    my $req = shift;
    HTTP::Engine::Response->new( body => 'hello' );
};

we hope simple syntax

use strict;
use warnings;
use HTTPEx::Declare qw( res redirect );

interface {
    module => 'ServerSimple',
    args   => {
        host => 'localhost',
        port =>  1978,
    }
};

run {
    my $req = shift;
    res( body => 'hello' ); # or redirect( location => 'http://example.com/' );
};

onuywtmhqfonuywtmhqf2013/12/17 12:32haugxiuuq.fohjof, <a href="http://www.sscxbvbtmm.com/">juvezoacly</a> , [url=http://www.vgvsqralvh.com/]wzqpauxgcm[/url], http://www.xzhmcspalp.com/ juvezoacly

kbnogjrlnskbnogjrlns2014/04/11 10:40yztwaiuuq.fohjof, <a href="http://www.pccosourup.com/">xqttoxongd</a> , [url=http://www.scyvfqaujb.com/]bijbtdqqbq[/url], http://www.lutdmxzwws.com/ xqttoxongd

 |