[Catalyst-commits] r8961 - in Catalyst-Runtime/5.80/trunk: . lib
lib/Catalyst
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Sat Dec 27 22:40:10 GMT 2008
Author: t0m
Date: 2008-12-27 22:40:10 +0000 (Sat, 27 Dec 2008)
New Revision: 8961
Modified:
Catalyst-Runtime/5.80/trunk/TODO
Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Request.pm
Log:
Replace {_body} instance access with calls to _body accessors..
Modified: Catalyst-Runtime/5.80/trunk/TODO
===================================================================
--- Catalyst-Runtime/5.80/trunk/TODO 2008-12-27 20:50:12 UTC (rev 8960)
+++ Catalyst-Runtime/5.80/trunk/TODO 2008-12-27 22:40:10 UTC (rev 8961)
@@ -6,6 +6,8 @@
- Re-opening packages with MX::Emulate::CAF (for
Catalyst::Plugin::HashedCookies)
+
+ - Double-applying mk_accessors breaks, t/double_apply.t for MX::Emulate::CAF
Back-compat investigation / known issues:
@@ -68,8 +70,6 @@
- After that set up attr handlers that will output helpful error messages
when you do it as well as how to fix it. (done already?)
- - Comments marked /Moose TODO/i in Catalyst::Request re {_body} (t0m)
-
- Eliminate all instances of $instance->{$key}, I think the only thing
left is lib/Catalyst/Engine/HTTP.pm: $self->{inputbuf}, which I haven't
touched as it is used as an lvalue in a lot of places (t0m)
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine.pm 2008-12-27 20:50:12 UTC (rev 8960)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine.pm 2008-12-27 22:40:10 UTC (rev 8961)
@@ -129,7 +129,7 @@
$c->res->_clear_context;
# Don't show body parser in the dump
- delete $c->req->{_body};
+ $c->req->_clear_body;
my @infos;
my $i = 0;
@@ -313,10 +313,10 @@
if ( my $length = $self->read_length ) {
my $request = $c->request;
- unless ( $request->{_body} ) {
+ unless ( $request->_body ) {
my $type = $request->header('Content-Type');
- $request->{_body} = HTTP::Body->new( $type, $length );
- $request->{_body}->tmpdir( $c->config->{uploadtmp} )
+ $request->_body(HTTP::Body->new( $type, $length ));
+ $request->_body->tmpdir( $c->config->{uploadtmp} )
if exists $c->config->{uploadtmp};
}
@@ -334,7 +334,7 @@
}
else {
# Defined but will cause all body code to be skipped
- $c->request->{_body} = 0;
+ $c->request->_body(0);
}
}
@@ -347,7 +347,7 @@
sub prepare_body_chunk {
my ( $self, $c, $chunk ) = @_;
- $c->request->{_body}->add($chunk);
+ $c->request->_body->add($chunk);
}
=head2 $self->prepare_body_parameters($c)
@@ -359,9 +359,9 @@
sub prepare_body_parameters {
my ( $self, $c ) = @_;
- return unless $c->request->{_body};
+ return unless $c->request->_body;
- $c->request->body_parameters( $c->request->{_body}->param );
+ $c->request->body_parameters( $c->request->_body->param );
}
=head2 $self->prepare_connection($c)
@@ -511,9 +511,9 @@
my ( $self, $c ) = @_;
my $request = $c->request;
- return unless $request->{_body};
+ return unless $request->_body;
- my $uploads = $request->{_body}->upload;
+ my $uploads = $request->_body->upload;
my $parameters = $request->parameters;
foreach my $name (keys %$uploads) {
my $files = $uploads->{$name};
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Request.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Request.pm 2008-12-27 20:50:12 UTC (rev 8960)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Request.pm 2008-12-27 22:40:10 UTC (rev 8961)
@@ -97,7 +97,7 @@
);
has _body => (
- is => 'rw',
+ is => 'rw', clearer => '_clear_body', predicate => '_has_body',
);
# Eugh, ugly. Should just be able to rename accessor methods to 'body'
# and provide a custom reader..
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2008-12-27 20:50:12 UTC (rev 8960)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2008-12-27 22:40:10 UTC (rev 8961)
@@ -1747,9 +1747,7 @@
sub prepare_body {
my $c = shift;
- #Moose TODO: what is _body ??
- # Do we run for the first time?
- return if defined $c->request->{_body};
+ return if $c->request->_has_body;
# Initialize on-demand data
$c->engine->prepare_body( $c, @_ );
More information about the Catalyst-commits
mailing list