Changeset 17398

Show
Ignore:
Timestamp:
08/11/08 16:07:03 (5 years ago)
Author:
yappo
Message:

pod rewrite

Location:
lang/perl/HTTP-Engine/trunk/lib/HTTP
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/HTTP-Engine/trunk/lib/HTTP/Engine.pm

    r17384 r17398  
    4545  use Data::Dumper; 
    4646  sub handle_request { 
    47       my $c = shift; 
    48       $c->res->body( Dumper($c->req) ); 
     47      my $req = shift; 
     48      HTTP::Engine::Response->new( body => Dumper($req) ); 
    4949  } 
    5050 
     
    5454Version 0.0.x is a concept release, the internal interface is still fluid.  
    5555It is mostly based on the code of Catalyst::Engine. 
     56 
     57=head1 COMPATIBILITY 
     58 
     59version over 0.0.13_1 is uncompatible of version under 0.0.13_1. 
     60 
     61useing L<HTTP::Engine::Conpat> module if you want compatibility of version under 0.0.13_1. 
     62 
     63version over 0.0.13_1 is unsupported of context and middleware. 
    5664 
    5765=head1 DESCRIPTION 
     
    128136  )->run(); 
    129137 
    130 =head1 MIDDLEWARES 
    131  
    132 For all non-core middlewares (consult #codrepos first), use the HTTPEx:: 
    133 namespace. For example, if you have a plugin module named "HTTPEx::Middleware::Foo", 
    134 you could load it as 
    135  
    136   use HTTP::Engine middlewares => [ qw( +HTTPEx::Plugin::Foo ) ]; 
    137  
    138 =head1 METHODS 
    139  
    140 =over 4 
    141  
    142 =item load_middleware(middleware) 
    143  
    144 =item load_middlewares(qw/ middleware middleware /) 
    145  
    146 Loads the given middleware into the HTTP::Engine. 
    147  
    148 =back 
    149  
    150138=head1 CONCEPT 
    151139 
  • lang/perl/HTTP-Engine/trunk/lib/HTTP/Engine/Interface/Test.pm

    r17379 r17398  
    5757      }, 
    5858      request_handler => sub { 
    59           my $c = shift; 
    60           $c->res->body( Dumper($c) ); 
     59          my $req = shift; 
     60          HTTP::Engine::Response->new( body => Dumper($req) ); 
    6161      } 
    6262  )->run(HTTP::Request->new( GET => 'http://localhost/'), \%ENV); 
  • lang/perl/HTTP-Engine/trunk/lib/HTTP/Engine/Request.pm

    r17384 r17398  
    376376=head1 SYNOPSIS 
    377377 
    378     $c->req 
     378    sub handle_request { 
     379        my $req = shift; 
    379380 
    380381=head1 ATTRIBUTES 
     
    385386 
    386387Returns the IP address of the client. 
    387  
    388 =item context 
    389  
    390 Returns the HTTP::Context(internal use only) 
    391388 
    392389=item cookies 
     
    478475A convenient method to access $req->cookies. 
    479476 
    480     $cookie  = $c->req->cookie('name'); 
    481     @cookies = $c->req->cookie; 
     477    $cookie  = $req->cookie('name'); 
     478    @cookies = $req->cookie; 
    482479 
    483480=item param 
    484481 
    485482Returns GET and POST parameters with a CGI.pm-compatible param method. This  
    486 is an alternative method for accessing parameters in $c->req->parameters. 
    487  
    488     $value  = $c->req->param( 'foo' ); 
    489     @values = $c->req->param( 'foo' ); 
    490     @params = $c->req->param; 
     483is an alternative method for accessing parameters in $req->parameters. 
     484 
     485    $value  = $req->param( 'foo' ); 
     486    @values = $req->param( 'foo' ); 
     487    @params = $req->param; 
    491488 
    492489Like L<CGI>, and B<unlike> earlier versions of Catalyst, passing multiple 
    493490arguments to this method, like this: 
    494491 
    495     $c->req->param( 'foo', 'bar', 'gorch', 'quxx' ); 
     492    $req->param( 'foo', 'bar', 'gorch', 'quxx' ); 
    496493 
    497494will set the parameter C<foo> to the multiple values C<bar>, C<gorch> and 
     
    508505A convenient method to access $req->uploads. 
    509506 
    510     $upload  = $c->req->upload('field'); 
    511     @uploads = $c->req->upload('field'); 
    512     @fields  = $c->req->upload; 
    513  
    514     for my $upload ( $c->req->upload('field') ) { 
     507    $upload  = $req->upload('field'); 
     508    @uploads = $req->upload('field'); 
     509    @fields  = $req->upload; 
     510 
     511    for my $upload ( $req->upload('field') ) { 
    515512        print $upload->filename; 
    516513    } 
  • lang/perl/HTTP-Engine/trunk/lib/HTTP/Engine/Response.pm

    r17384 r17398  
    8080=head1 SYNOPSIS 
    8181 
    82     $c->res 
     82    sub handle_request { 
     83        my $req = shift; 
     84        my $res = HTTP::Engine::Response->new; 
     85        $res->body('foo'); 
     86        return $res; 
     87    } 
    8388 
    8489=head1 ATTRIBUTES 
     
    99104references used to construct a L<CGI::Cookie> object. 
    100105 
    101         $c->res->cookies->{foo} = { value => '123' }; 
     106        $res->cookies->{foo} = { value => '123' }; 
    102107 
    103108The keys of the hash reference on the right correspond to the L<CGI::Cookie> 
     
    109114Sets or returns the HTTP status. 
    110115 
    111     $c->res->status(404); 
     116    $res->status(404); 
    112117 
    113118=item headers 
     
    115120Returns an L<HTTP::Headers> object, which can be used to set headers. 
    116121 
    117     $c->res->headers->header( 'X-HTTP-Engine' => $HTTP::Engine::VERSION ); 
     122    $res->headers->header( 'X-HTTP-Engine' => $HTTP::Engine::VERSION ); 
    118123 
    119124=item redirect 
     
    121126Causes the response to redirect to the specified URL. 
    122127 
    123     $c->res->redirect( 'http://slashdot.org' ); 
    124     $c->res->redirect( 'http://slashdot.org', 307 ); 
     128    $res->redirect( 'http://slashdot.org' ); 
     129    $res->redirect( 'http://slashdot.org', 307 ); 
    125130 
    126131=item set_http_response