From: Christian Hansen Date: Fri, 25 Mar 2005 17:08:31 +0000 (+0000) Subject: rename C::E::HTTP.pm to C::E::LWP.pm X-Git-Tag: 5.7099_04~1686 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=6f4e1683d466d0123cc7507b29a55b474ddca594 rename C::E::HTTP.pm to C::E::LWP.pm --- diff --git a/Changes b/Changes index f01d347..7555c80 100644 --- a/Changes +++ b/Changes @@ -4,6 +4,8 @@ This file documents the revision history for Perl extension Catalyst. - whole new core for private action inheritance - problems with mod_perl2 fixed - added Test::Pod support + - added new server backend with HTTP/1.1 support + - added option to run tests against a remote server 4.34 Wed Mar 23 07:00:00 2005 - added some messages to Makefile.PL @@ -11,7 +13,7 @@ This file documents the revision history for Perl extension Catalyst. - added Catalyst::Engine::CGI::NPH - simplified Catalyst::Log to be easier to implement/subclass - added cgi.pl - - updated Catalyst::Log to use Catalyst::Engine::Test + - updated Catalyst::Test to use Catalyst::Engine::Test - updated helper scripts IMPORTANT: this will be the last time you'll have to regenerate the script directory. We promise! diff --git a/Makefile.PL b/Makefile.PL index 3c65b43..7f477f1 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -9,12 +9,16 @@ WriteMakefile( CGI::Simple => 0, Class::Accessor::Fast => 0, Class::Data::Inheritable => 0, + HTTP::Daemon => 0, HTML::Entities => 0, HTTP::Headers => 0, - HTTP::Server::Simple => '0.04', + HTTP::Request => 0, + HTTP::Response => 0, + LWP::UserAgent => 0, Module::Pluggable::Fast => 0, Tree::Simple => 0, Tree::Simple::Visitor::FindByPath => 0, + URI => 0, } ); diff --git a/lib/Catalyst/Base.pm b/lib/Catalyst/Base.pm index 6448f3d..94a0f98 100644 --- a/lib/Catalyst/Base.pm +++ b/lib/Catalyst/Base.pm @@ -90,6 +90,8 @@ sub config { sub process { 1 } +=back + =head1 SEE ALSO L. diff --git a/lib/Catalyst/Engine/HTTP.pm b/lib/Catalyst/Engine/LWP.pm similarity index 82% rename from lib/Catalyst/Engine/HTTP.pm rename to lib/Catalyst/Engine/LWP.pm index 861ec5a..01580a0 100644 --- a/lib/Catalyst/Engine/HTTP.pm +++ b/lib/Catalyst/Engine/LWP.pm @@ -1,4 +1,4 @@ -package Catalyst::Engine::HTTP; +package Catalyst::Engine::LWP; use strict; use base 'Catalyst::Engine'; @@ -11,9 +11,9 @@ use HTTP::Response; use IO::File; use URI; -__PACKAGE__->mk_accessors(qw/http/); +__PACKAGE__->mk_accessors(qw/lwp/); -Class::Struct::struct 'Catalyst::Engine::HTTP::LWP' => { +Class::Struct::struct 'Catalyst::Engine::LWP::HTTP' => { request => 'HTTP::Request', response => 'HTTP::Response', hostname => '$', @@ -22,7 +22,7 @@ Class::Struct::struct 'Catalyst::Engine::HTTP::LWP' => { =head1 NAME -Catalyst::Engine::HTTP - Catalyst HTTP Engine +Catalyst::Engine::LWP - Catalyst LWP Engine =head1 SYNOPSIS @@ -62,7 +62,7 @@ sub finalize_headers { $response->header( 'Set-Cookie' => $cookie->as_string ); } - $c->http->response($response); + $c->lwp->response($response); } =item $c->finalize_output @@ -71,7 +71,7 @@ sub finalize_headers { sub finalize_output { my $c = shift; - $c->http->response->content_ref( \$c->response->{output} ); + $c->lwp->response->content_ref( \$c->response->{output} ); } =item $c->prepare_connection @@ -80,8 +80,8 @@ sub finalize_output { sub prepare_connection { my $c = shift; - $c->req->hostname( $c->http->hostname ); - $c->req->address( $c->http->address ); + $c->req->hostname( $c->lwp->hostname ); + $c->req->address( $c->lwp->address ); } =item $c->prepare_cookies @@ -91,7 +91,7 @@ sub prepare_connection { sub prepare_cookies { my $c = shift; - if ( my $header = $c->http->request->header('Cookie') ) { + if ( my $header = $c->lwp->request->header('Cookie') ) { $c->req->cookies( { CGI::Simple::Cookie->parse($header) } ); } } @@ -102,8 +102,8 @@ sub prepare_cookies { sub prepare_headers { my $c = shift; - $c->req->method( $c->http->request->method ); - $c->req->headers( $c->http->request->headers ); + $c->req->method( $c->lwp->request->method ); + $c->req->headers( $c->lwp->request->headers ); } =item $c->prepare_parameters @@ -114,7 +114,7 @@ sub prepare_parameters { my $c = shift; my @params = (); - my $request = $c->http->request; + my $request = $c->lwp->request; push( @params, $request->uri->query_form ); @@ -176,9 +176,9 @@ sub prepare_path { my $base; { - my $scheme = $c->http->request->uri->scheme; - my $host = $c->http->request->uri->host; - my $port = $c->http->request->uri->port; + my $scheme = $c->lwp->request->uri->scheme; + my $host = $c->lwp->request->uri->host; + my $port = $c->lwp->request->uri->port; $base = URI->new; $base->scheme($scheme); @@ -188,7 +188,7 @@ sub prepare_path { $base = $base->canonical->as_string; } - my $path = $c->http->request->uri->path || '/'; + my $path = $c->lwp->request->uri->path || '/'; $path =~ s/^\///; $c->req->base($base); @@ -200,8 +200,8 @@ sub prepare_path { =cut sub prepare_request { - my ( $c, $http ) = @_; - $c->http($http); + my ( $c, $lwp ) = @_; + $c->lwp($lwp); } =item $c->prepare_uploads diff --git a/lib/Catalyst/Engine/HTTP/Daemon.pm b/lib/Catalyst/Engine/LWP/Daemon.pm similarity index 71% rename from lib/Catalyst/Engine/HTTP/Daemon.pm rename to lib/Catalyst/Engine/LWP/Daemon.pm index 3ccdfba..84b9c27 100644 --- a/lib/Catalyst/Engine/HTTP/Daemon.pm +++ b/lib/Catalyst/Engine/LWP/Daemon.pm @@ -1,22 +1,22 @@ -package Catalyst::Engine::HTTP::Daemon; +package Catalyst::Engine::LWP::Daemon; use strict; -use base 'Catalyst::Engine::HTTP'; +use base 'Catalyst::Engine::LWP'; use IO::Socket qw(AF_INET); =head1 NAME -Catalyst::Engine::HTTP::Daemon - Catalyst HTTP Daemon Engine +Catalyst::Engine::LWP::Daemon - Catalyst LWP Daemon Engine =head1 SYNOPSIS -A script using the Catalyst::Engine::HTTP::Daemon module might look like: +A script using the Catalyst::Engine::LWP::Daemon module might look like: #!/usr/bin/perl -w BEGIN { - $ENV{CATALYST_ENGINE} = 'HTTP::Daemon'; + $ENV{CATALYST_ENGINE} = 'LWP::Daemon'; } use strict; @@ -31,7 +31,7 @@ This is the Catalyst engine specialized for development and testing. =head1 OVERLOADED METHODS -This class overloads some methods from C. +This class overloads some methods from C. =over 4 @@ -45,7 +45,7 @@ sub run { my $class = shift; my $port = shift || 3000; - my $daemon = Catalyst::Engine::HTTP::Daemon::Catalyst->new( + my $daemon = Catalyst::Engine::LWP::Daemon::Catalyst->new( LocalPort => $port, ReuseAddr => 1 ); @@ -62,14 +62,14 @@ sub run { $request->uri->scheme('http'); # Force URI::http - my $http = Catalyst::Engine::HTTP::LWP->new( + my $lwp = Catalyst::Engine::LWP::HTTP->new( request => $request, address => $connection->peerhost, hostname => gethostbyaddr( $connection->peeraddr, AF_INET ) ); - $class->handler($http); - $connection->send_response( $http->response ); + $class->handler($lwp); + $connection->send_response( $lwp->response ); } $connection->close; @@ -95,7 +95,7 @@ the same terms as Perl itself. =cut -package Catalyst::Engine::HTTP::Daemon::Catalyst; +package Catalyst::Engine::LWP::Daemon::Catalyst; use strict; use base 'HTTP::Daemon'; diff --git a/lib/Catalyst/Engine/Server.pm b/lib/Catalyst/Engine/Server.pm index 02d9607..8db6d33 100644 --- a/lib/Catalyst/Engine/Server.pm +++ b/lib/Catalyst/Engine/Server.pm @@ -1,7 +1,7 @@ package Catalyst::Engine::Server; use strict; -use base 'Catalyst::Engine::HTTP::Daemon'; +use base 'Catalyst::Engine::LWP::Daemon'; =head1 NAME @@ -29,7 +29,7 @@ This is the Catalyst engine specialized for development and testing. =head1 SEE ALSO -L, L. +L, L. =head1 AUTHOR diff --git a/lib/Catalyst/Engine/Test.pm b/lib/Catalyst/Engine/Test.pm index 1a4a0e8..fcd145e 100644 --- a/lib/Catalyst/Engine/Test.pm +++ b/lib/Catalyst/Engine/Test.pm @@ -1,7 +1,7 @@ package Catalyst::Engine::Test; use strict; -use base 'Catalyst::Engine::HTTP'; +use base 'Catalyst::Engine::LWP'; =head1 NAME @@ -29,7 +29,7 @@ This is the Catalyst engine specialized for testing. =head1 OVERLOADED METHODS -This class overloads some methods from C. +This class overloads some methods from C. =over 4 @@ -54,15 +54,15 @@ sub run { $request = HTTP::Request->new( 'GET', $request ); } - my $http = Catalyst::Engine::HTTP::LWP->new( + my $lwp = Catalyst::Engine::LWP::HTTP->new( request => $request, address => '127.0.0.1', hostname => 'localhost' ); - $class->handler($http); + $class->handler($lwp); - return $http->response; + return $lwp->response; } =back diff --git a/lib/Catalyst/Manual/Intro.pod b/lib/Catalyst/Manual/Intro.pod index 042face..560274d 100644 --- a/lib/Catalyst/Manual/Intro.pod +++ b/lib/Catalyst/Manual/Intro.pod @@ -71,6 +71,8 @@ Use L or L. The best part is that Catalyst implements all this flexibility in a very simple way. +=over 4 + =item * B Components interoperate very smoothly. For example, Catalyst automatically makes a L object available in every component. Via the context, you can access the request object, share data between components, and control the flow of your application. Building a Catalyst application feels a lot like snapping together toy building blocks, and everything just works. @@ -91,6 +93,8 @@ Catalyst comes with a builtin, lightweight http server and test framework, makin Catalyst provides helper scripts to quickly generate running starter code for components and unit tests. +=back + =head2 Quickstart Here's how to install Catalyst and get a simple application up and running, using the helper scripts described above.