- 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
- 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!
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,
}
);
sub process { 1 }
+=back
+
=head1 SEE ALSO
L<Catalyst>.
-package Catalyst::Engine::HTTP;
+package Catalyst::Engine::LWP;
use strict;
use base 'Catalyst::Engine';
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 => '$',
=head1 NAME
-Catalyst::Engine::HTTP - Catalyst HTTP Engine
+Catalyst::Engine::LWP - Catalyst LWP Engine
=head1 SYNOPSIS
$response->header( 'Set-Cookie' => $cookie->as_string );
}
- $c->http->response($response);
+ $c->lwp->response($response);
}
=item $c->finalize_output
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
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
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) } );
}
}
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
my $c = shift;
my @params = ();
- my $request = $c->http->request;
+ my $request = $c->lwp->request;
push( @params, $request->uri->query_form );
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);
$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);
=cut
sub prepare_request {
- my ( $c, $http ) = @_;
- $c->http($http);
+ my ( $c, $lwp ) = @_;
+ $c->lwp($lwp);
}
=item $c->prepare_uploads
-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;
=head1 OVERLOADED METHODS
-This class overloads some methods from C<Catalyst::Engine::HTTP>.
+This class overloads some methods from C<Catalyst::Engine::LWP>.
=over 4
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
);
$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;
=cut
-package Catalyst::Engine::HTTP::Daemon::Catalyst;
+package Catalyst::Engine::LWP::Daemon::Catalyst;
use strict;
use base 'HTTP::Daemon';
package Catalyst::Engine::Server;
use strict;
-use base 'Catalyst::Engine::HTTP::Daemon';
+use base 'Catalyst::Engine::LWP::Daemon';
=head1 NAME
=head1 SEE ALSO
-L<Catalyst>, L<Catalyst::Engine::HTTP::Daemon>.
+L<Catalyst>, L<Catalyst::Engine::LWP::Daemon>.
=head1 AUTHOR
package Catalyst::Engine::Test;
use strict;
-use base 'Catalyst::Engine::HTTP';
+use base 'Catalyst::Engine::LWP';
=head1 NAME
=head1 OVERLOADED METHODS
-This class overloads some methods from C<Catalyst::Engine::HTTP>.
+This class overloads some methods from C<Catalyst::Engine::LWP>.
=over 4
$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
The best part is that Catalyst implements all this flexibility in a very simple way.
+=over 4
+
=item * B<Building Block Interface>
Components interoperate very smoothly. For example, Catalyst automatically makes a L<Context> 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.
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.