[Catalyst-commits] r7981 - in Catalyst-Runtime/5.80/trunk: . lib
lib/Catalyst lib/Catalyst/DispatchType lib/Catalyst/Engine
lib/Catalyst/Engine/HTTP lib/Catalyst/Engine/HTTP/Restarter
lib/Catalyst/Request
groditi at dev.catalyst.perl.org
groditi at dev.catalyst.perl.org
Mon Jun 23 22:19:18 BST 2008
Author: groditi
Date: 2008-06-23 22:19:18 +0100 (Mon, 23 Jun 2008)
New Revision: 7981
Modified:
Catalyst-Runtime/5.80/trunk/
Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Action.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/ActionChain.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/ActionContainer.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/AttrContainer.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Base.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Chained.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Default.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Index.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Path.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Regex.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Dispatcher.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/CGI.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/FastCGI.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP/Restarter.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Model.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Request.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Request/Upload.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Response.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/View.pm
Log:
r17830 at martha (orig r7761): groditi | 2008-05-17 17:52:33 -0400
start using Class::C3, may need to add a reinitalize bit later, not sure
Property changes on: Catalyst-Runtime/5.80/trunk
___________________________________________________________________
Name: svk:merge
- 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/trunk:7576
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/moose:7726
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-ChildOf:4443
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-Runtime-jrockway:5857
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-component-setup:4320
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-docs:4325
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/current/Catalyst-Runtime:5142
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst:4483
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst-Runtime:6165
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime:8339
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime-jrockway:8342
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime:6511
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime-current:10442
+ 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/trunk:7576
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/moose:7761
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-ChildOf:4443
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-Runtime-jrockway:5857
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-component-setup:4320
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-docs:4325
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/current/Catalyst-Runtime:5142
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst:4483
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst-Runtime:6165
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime:8339
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime-jrockway:8342
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime:6511
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime-current:10442
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Action.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Action.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Action.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -17,6 +17,7 @@
=cut
+use Class::C3;
use Moose;
has class => (is => 'rw');
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/ActionChain.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/ActionChain.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/ActionChain.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,10 +1,13 @@
package Catalyst::ActionChain;
+use Class::C3;
use Moose;
extends qw(Catalyst::Action);
has chain => (is => 'rw');
+no Moose;
+
=head1 NAME
Catalyst::ActionChain - Chain of Catalyst Actions
@@ -57,7 +60,6 @@
return $self->new({ %$final, chain => $actions });
}
-no Moose;
__PACKAGE__->meta->make_immutable;
1;
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/ActionContainer.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/ActionContainer.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/ActionContainer.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -15,6 +15,7 @@
=cut
+use Class::C3;
use Moose;
use overload (
@@ -27,14 +28,14 @@
has part => (is => 'rw', required => 1, lazy => 1, default => sub { {} });
has actions => (is => 'rw', required => 1, lazy => 1, default => sub { {} });
-around 'new' => sub {
- my $next = shift;
+no Moose;
+
+sub new {
my ($self, $params) = @_;
$params = { part => $params } unless ref $params;
- $next->($self, $params);
-};
+ $self->next::method($params);
+}
-no Moose;
sub get_action {
my ( $self, $name ) = @_;
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/AttrContainer.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/AttrContainer.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/AttrContainer.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -5,6 +5,8 @@
with 'Catalyst::ClassData';
+no Moose;
+
__PACKAGE__->mk_classdata($_) for qw/_attr_cache _action_cache/;
__PACKAGE__->_attr_cache( {} );
__PACKAGE__->_action_cache( [] );
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Base.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Base.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Base.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,9 +1,10 @@
package Catalyst::Base;
+use Class::C3;
use Moose;
BEGIN{ extends qw/Catalyst::Controller/ };
+no Moose;
-
1;
__END__
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,5 +1,6 @@
package Catalyst::Component;
+use Class::C3;
use Moose;
use MooseX::Adopt::Class::Accessor::Fast;
use Catalyst::Utils;
@@ -8,6 +9,7 @@
with 'MooseX::Emulate::Class::Accessor::Fast';
with 'Catalyst::ClassData';
+no Moose;
=head1 NAME
@@ -54,38 +56,32 @@
__PACKAGE__->mk_classdata($_) for qw/_config _plugins/;
-around new => sub {
- my $orig = shift;
+sub new {
my ( $self, $c ) = @_;
# Temporary fix, some components does not pass context to constructor
my $arguments = ( ref( $_[-1] ) eq 'HASH' ) ? $_[-1] : {};
my $args = $self->merge_config_hashes( $self->config, $arguments );
- return $self->$orig( $args );
-};
+ $self->next::method( $args );
+}
sub COMPONENT {
my ( $self, $c ) = @_;
# Temporary fix, some components does not pass context to constructor
my $arguments = ( ref( $_[-1] ) eq 'HASH' ) ? $_[-1] : {};
- $self->new($c, $arguments);
-# if ( my $new = $self->NEXT::COMPONENT( $c, $arguments ) ) {
-# return $new;
-# }
-# else {
-# if ( my $new = $self->new( $c, $arguments ) ) {
-# return $new;
-# }
-# else {
-# my $class = ref $self || $self;
-# my $new = $self->merge_config_hashes(
-# $self->config, $arguments );
-# return bless $new, $class;
-# }
-# }
+
+ #this is not the EXACT logic we had before, since the original tested
+ #for a true value before returning meaning that a subsequent COMPONENT
+ #call could return undef and that would trigger a try to new, which could
+ #again return undef, which would lead to a straight bless of the args and
+ #config. I did not mantain that behavior because it did not seemed sane
+ # please rip me a new one if you have reason to believe i am being stupid
+ # --groditi
+ return $self->next::can ?
+ $self->next::method($c, $arguments) : $self->new($c, $arguments);
}
sub config {
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,6 +1,7 @@
package Catalyst::Controller;
#switch to BEGIN { extends qw/ ... /; } ?
+use Class::C3;
use base qw/Catalyst::Component Catalyst::AttrContainer/;
use Moose;
@@ -34,7 +35,7 @@
# isa => 'ClassName|Catalyst' ?
has _application => (is => 'rw');
-sub _app{ shift->_application(@_) } # eww
+sub _app{ shift->_application(@_) }
sub BUILD {
my ($self, $args) = @_;
@@ -122,14 +123,13 @@
return !@{ $c->error };
}
-around new => sub {
- my $orig = shift;
+sub new {
my $self = shift;
my $app = $_[0];
- my $new = $self->$orig(@_);
+ my $new = $self->next::method(@_);
$new->_application( $app );
return $new;
-};
+}
sub action_for {
my ( $self, $name ) = @_;
@@ -137,18 +137,25 @@
return $app->dispatcher->get_action($name, $self->action_namespace);
}
+#my opinion is that this whole sub really should be a builder method, not
+#something that happens on every call. Anyone else disagree?? -- groditi
+
+#we are wrapping the accessor, so just uyse a modifier since a normal sub would
+#just be overridden by the generated moose method
around action_namespace => sub {
- my ( $orig, $self, $c ) = @_;
+ my $orig = shift;
+ my ( $self, $c ) = @_;
if( ref($self) ){
return $self->$orig if $self->has_action_namespace;
- } else {
+ } else {
+ # if the following won't change at runtime it should be lazy_building thing
return $self->config->{namespace} if exists $self->config->{namespace};
}
#the following looks like a possible target for a default setting. i am not
#making the below the builder because i don't know if $c will vary from
- #call to call, which would affect case sensitivitysettings -- groditi
+ #call to call, which would affect case sensitivity settings -- groditi
my $case_s;
if( $c ){
$case_s = $c->config->{case_sensitive};
@@ -167,7 +174,7 @@
return Catalyst::Utils::class2prefix(ref($self) || $self, $case_s) || '';
};
-
+#Once again, this is probably better written as a builder method
around path_prefix => sub {
my $orig = shift;
my $self = shift;
@@ -362,6 +369,8 @@
return ( 'ActionClass', $value );
}
+no Moose;
+
1;
__END__
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Chained.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Chained.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Chained.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,5 +1,6 @@
package Catalyst::DispatchType::Chained;
+use Class::C3;
use Moose;
extends 'Catalyst::DispatchType';
@@ -28,6 +29,8 @@
default => sub{ {} },
);
+no Moose;
+
# please don't perltidy this. hairy code within.
=head1 NAME
@@ -328,7 +331,6 @@
}
-no Moose;
__PACKAGE__->meta->make_immutable;
=head1 USAGE
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Default.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Default.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Default.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,12 +1,11 @@
package Catalyst::DispatchType::Default;
+use Class::C3;
use Moose;
extends 'Catalyst::DispatchType';
+no Moose;
-#use strict;
-#use base qw/Catalyst::DispatchType/;
-
=head1 NAME
Catalyst::DispatchType::Default - Default DispatchType
@@ -61,7 +60,6 @@
=cut
-no Moose;
__PACKAGE__->meta->make_immutable;
1;
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Index.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Index.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Index.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,11 +1,10 @@
package Catalyst::DispatchType::Index;
+use Class::C3;
use Moose;
extends 'Catalyst::DispatchType';
+no Moose;
-#use strict;
-#use base qw/Catalyst::DispatchType/;
-
=head1 NAME
Catalyst::DispatchType::Index - Index DispatchType
@@ -69,7 +68,6 @@
=cut
-no Moose;
__PACKAGE__->meta->make_immutable;
1;
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Path.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Path.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Path.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,10 +1,9 @@
package Catalyst::DispatchType::Path;
+use Class::C3;
use Moose;
extends 'Catalyst::DispatchType';
-#use strict;
-#use base qw/Catalyst::DispatchType/;
use Text::SimpleTable;
use URI;
@@ -15,6 +14,8 @@
default => sub { +{} },
);
+no Moose;
+
=head1 NAME
Catalyst::DispatchType::Path - Path DispatchType
@@ -140,7 +141,6 @@
=cut
-no Moose;
__PACKAGE__->meta->make_immutable;
1;
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Regex.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Regex.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType/Regex.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,10 +1,9 @@
package Catalyst::DispatchType::Regex;
+use Class::C3;
use Moose;
extends 'Catalyst::DispatchType::Path';
-#use strict;
-#use base qw/Catalyst::DispatchType::Path/;
use Text::SimpleTable;
use Text::Balanced ();
@@ -15,6 +14,8 @@
default => sub{ [] },
);
+no Moose;
+
=head1 NAME
Catalyst::DispatchType::Regex - Regex DispatchType
@@ -161,7 +162,6 @@
=cut
-no Moose;
__PACKAGE__->meta->make_immutable;
1;
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/DispatchType.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,8 +1,8 @@
package Catalyst::DispatchType;
-use Moose;
-#use strict;
-#use base 'Class::Accessor::Fast';
+use Class::C3;
+use Moose; # using it to add Moose::Object to @ISA ...
+no Moose;
=head1 NAME
@@ -71,7 +71,6 @@
=cut
-no Moose;
__PACKAGE__->meta->make_immutable;
1;
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Dispatcher.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Dispatcher.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Dispatcher.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -519,7 +519,7 @@
for my $type (@types) {
my $class =
( $type =~ /^\+(.*)$/ ) ? $1 : "Catalyst::DispatchType::${type}";
- #eval "require $class";
+
eval { Class::MOP::load_class($class) };
Catalyst::Exception->throw( message => qq/Couldn't load "$class"/ )
if $@;
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/CGI.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/CGI.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/CGI.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,10 +1,13 @@
package Catalyst::Engine::CGI;
+use Class::C3;
use Moose;
extends 'Catalyst::Engine';
has env => (is => 'rw');
+no Moose;
+
=head1 NAME
Catalyst::Engine::CGI - The CGI Engine
@@ -172,15 +175,14 @@
=cut
-around prepare_query_parameters => sub {
- my $orig = shift;
+sub prepare_query_parameters {
my ( $self, $c ) = @_;
local (*ENV) = $self->env || \%ENV;
if ( $ENV{QUERY_STRING} ) {
- $self->$orig( $c, $ENV{QUERY_STRING} );
+ $self->next::method( $c, $ENV{QUERY_STRING} );
}
-};
+}
=head2 $self->prepare_request($c, (env => \%env))
@@ -200,9 +202,10 @@
=cut
-before prepare_write => sub {
+sub prepare_write {
*STDOUT->autoflush(1);
-};
+ return shift->next::method(@_);
+}
=head2 $self->write($c, $buffer)
@@ -210,8 +213,7 @@
=cut
-around write => sub {
- my $orig = shift;
+sub write {
my ( $self, $c, $buffer ) = @_;
# Prepend the headers if they have not yet been sent
@@ -219,8 +221,8 @@
$buffer = $headers . $buffer;
}
- return $self->$orig( $c, $buffer );
-};
+ return $self->next::method( $c, $buffer );
+}
=head2 $self->read_chunk($c, $buffer, $length)
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/FastCGI.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/FastCGI.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/FastCGI.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,8 +1,10 @@
package Catalyst::Engine::FastCGI;
+use Class::C3;
use Moose;
extends 'Catalyst::Engine::CGI';
+# eval { Class::MOP::load_class("FCGI") };
eval "use FCGI";
die "Unable to load the FCGI module, you may need to install it:\n$@\n" if $@;
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -13,16 +13,10 @@
has watch_list => (is => 'rw');
has follow_simlinks => (is => 'rw');
-sub new {
- my ( $class, %args ) = @_;
+no Moose;
- my $self = {%args};
-
- bless $self, $class;
-
- $self->_init;
-
- return $self;
+sub BUILD {
+ shift->_init;
}
sub _init {
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP/Restarter.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP/Restarter.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP/Restarter.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,11 +1,13 @@
package Catalyst::Engine::HTTP::Restarter;
+use Class::C3;
use Moose;
extends 'Catalyst::Engine::HTTP';
+no Moose;
+
use Catalyst::Engine::HTTP::Restarter::Watcher;
-around run => sub {
- my $orig = shift;
+sub run {
my ( $self, $class, $port, $host, $options ) = @_;
$options ||= {};
@@ -66,7 +68,7 @@
}
}
- return $self->$orig( $class, $port, $host, $options );
+ return $self->next::method( $class, $port, $host, $options );
};
1;
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine/HTTP.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,7 +1,10 @@
package Catalyst::Engine::HTTP;
+use Class::C3;
use Moose;
extends 'Catalyst::Engine::CGI';
+no Moose;
+
use Data::Dump qw(dump);
use Errno 'EWOULDBLOCK';
use HTTP::Date ();
@@ -83,20 +86,22 @@
=cut
-before finalize_read => sub {
+sub finalize_read {
# Never ever remove this, it would result in random length output
# streams if STDIN eq STDOUT (like in the HTTP engine)
*STDIN->blocking(1);
-};
+ shift->next::method(@_);
+}
=head2 $self->prepare_read($c)
=cut
-befpre prepare_read => sub {
+sub prepare_read {
# Set the input handle to non-blocking
*STDIN->blocking(0);
-};
+ shift->next::method(@_);
+}
=head2 $self->read_chunk($c, $buffer, $length)
@@ -138,8 +143,7 @@
=cut
-around write => sub {
- my $orig = shift;
+sub write {
my ( $self, $c, $buffer ) = @_;
# Avoid 'print() on closed filehandle Remote' warnings when using IE
@@ -150,7 +154,7 @@
$buffer = $headers . $buffer;
}
- my $ret = $self->$orig( $c, $buffer );
+ my $ret = $self->next::method($c, $buffer);
if ( !defined $ret ) {
$self->{_write_error} = $!;
@@ -159,9 +163,9 @@
else {
DEBUG && warn "write: Wrote response ($ret bytes)\n";
}
-
+
return $ret;
-};
+}
=head2 run
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Engine.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,5 +1,6 @@
package Catalyst::Engine;
+use Class::C3;
use Moose;
with 'MooseX::Emulate::Class::Accessor::Fast';
@@ -16,6 +17,8 @@
has read_length => (is => 'rw');
has read_position => (is => 'rw');
+no Moose;
+
# Stringify to class
use overload '""' => sub { return ref shift }, fallback => 1;
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Log.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,5 +1,6 @@
package Catalyst::Log;
+use Class::C3;
use Moose;
use Data::Dump;
@@ -36,13 +37,12 @@
}
}
-around new => sub {
- my $orig = shift;
+sub new {
my $class = shift;
- my $self = $class->$orig;
+ my $self = $class->next::method;
$self->levels( scalar(@_) ? @_ : keys %LEVELS );
return $self;
-};
+}
sub levels {
my ( $self, @levels ) = @_;
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Model.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Model.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Model.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -4,8 +4,10 @@
extends qw/Catalyst::Component/;
no Moose;
-__PACKAGE__->meta->make_immutable();
+#We can't immutablize anything that ISA Component just yet
+#__PACKAGE__->meta->make_immutable();
+
=head1 NAME
Catalyst::Model - Catalyst Model base class
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Request/Upload.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Request/Upload.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Request/Upload.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,5 +1,6 @@
package Catalyst::Request::Upload;
+use Class::C3;
use Moose;
use Catalyst::Exception;
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Request.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Request.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Request.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,5 +1,6 @@
package Catalyst::Request;
+use Class::C3;
use IO::Socket qw[AF_INET inet_aton];
use Carp;
use utf8;
@@ -32,9 +33,16 @@
lazy => 1,
);
+#Moose ToDo:
+#can we lose the before modifiers which just call prepare_body ?
+#they are wasteful, slow us down and feel cluttery.
+# Can we call prepare_body at BUILD time?
+# Can we make _body an attribute and have the rest of these lazy build from there?
+
has _context => (
is => 'rw',
weak_ref => 1,
+ handles => ['read'],
);
has body_parameters => (
@@ -56,10 +64,11 @@
default => sub { {} },
);
-before uploads => sub {
- my ($self) = @_;
- #$self->_context->prepare_body;
-};
+# modifier was a noop (groditi)
+# before uploads => sub {
+# my ($self) = @_;
+# #$self->_context->prepare_body;
+# };
has parameters => (
is => 'rw',
@@ -436,10 +445,6 @@
You have to set MyApp->config->{parse_on_demand} to use this directly.
-=cut
-
-sub read { shift->_context->read(@_); }
-
=head2 $req->referer
Shortcut for $req->headers->referer. Returns the referring page.
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Response.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Response.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Response.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,5 +1,6 @@
package Catalyst::Response;
+use Class::C3;
use Moose;
use HTTP::Headers;
@@ -18,6 +19,7 @@
has _context => (
is => 'rw',
weak_ref => 1,
+ handles => ['write'],
);
sub output { shift->body(@_) }
@@ -153,10 +155,6 @@
Writes $data to the output stream.
-=cut
-
-sub write { shift->_context->write(@_); }
-
=head2 meta
Provided by Moose
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/View.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/View.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/View.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -65,6 +65,6 @@
=cut
no Moose;
-__PACKAGE__->meta->make_immutable();
+#__PACKAGE__->meta->make_immutable();
1;
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2008-06-23 21:18:56 UTC (rev 7980)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2008-06-23 21:19:18 UTC (rev 7981)
@@ -1,5 +1,6 @@
package Catalyst;
+use Class::C3;
use Moose;
extends 'Catalyst::Component';
use bytes;
@@ -39,14 +40,13 @@
has response => (is => 'rw', default => sub { $_[0]->response_class->new({}) }, required => 1, lazy => 1);
has namespace => (is => 'rw');
+no Moose;
attributes->import( __PACKAGE__, \&namespace, 'lvalue' );
sub depth { scalar @{ shift->stack || [] }; }
+sub comp { shift->component(@_) }
-# Laziness++
-*comp = \&component;
-
sub req {
# carp "the use of req() is deprecated in favour of request()";
my $self = shift; return $self->request(@_);
@@ -57,7 +57,7 @@
}
# For backwards compatibility
-*finalize_output = \&finalize_body;
+sub finalize_output { shift->finalize_body(@_) };
# For statistics
our $COUNT = 1;
@@ -379,21 +379,21 @@
=cut
-around stash => sub {
- my $orig = shift;
+sub stash {
my $c = shift;
-
- my $orig_stash = $c->$orig();
if (@_) {
my $stash = @_ > 1 ? {@_} : $_[0];
croak('stash takes a hash or hashref') unless ref $stash;
foreach my $key ( keys %$stash ) {
- $orig_stash->{$key} = $stash->{$key};
+ #shouldn't we hold this in a var and save ourselves the subcall?
+ $c->next::method->{$key} = $stash->{$key};
}
}
- return $orig_stash;
-};
+ return $c->next::method;
+}
+
+
=head2 $c->error
=head2 $c->error($error, ...)
@@ -704,15 +704,14 @@
=cut
-around config => sub {
- my $orig = shift;
+sub config {
my $c = shift;
$c->log->warn("Setting config after setup has been run is not a good idea.")
if ( @_ and $c->setup_finished );
- $c->$orig(@_);
-};
+ $c->next::method(@_);
+}
=head2 $c->log
More information about the Catalyst-commits
mailing list