[Catalyst-commits] r7827 - in
Catalyst-Runtime/5.80/branches/moose/lib: . Catalyst
Catalyst/DispatchType Catalyst/Engine Catalyst/Engine/HTTP
Catalyst/Request
groditi at dev.catalyst.perl.org
groditi at dev.catalyst.perl.org
Wed May 28 03:42:31 BST 2008
Author: groditi
Date: 2008-05-28 03:42:31 +0100 (Wed, 28 May 2008)
New Revision: 7827
Modified:
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Action.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ActionChain.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ActionContainer.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Base.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Component.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Controller.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Chained.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Default.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Index.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Path.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Regex.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Dispatcher.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine/CGI.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine/FastCGI.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine/HTTP.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine/HTTP/Restarter.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Log.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Model.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Request.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Request/Upload.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Response.pm
Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/View.pm
Log:
bye bye Class::C3. for good.
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Action.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Action.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Action.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -17,8 +17,6 @@
=cut
-use MRO::Compat;
-use mro 'c3';
use Moose;
has class => (is => 'rw');
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ActionChain.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ActionChain.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ActionChain.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst::ActionChain;
-use MRO::Compat;
-use mro 'c3';
use Moose;
extends qw(Catalyst::Action);
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ActionContainer.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ActionContainer.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/ActionContainer.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -15,22 +15,18 @@
=cut
-use MRO::Compat;
-use mro 'c3';
use Moose;
has part => (is => 'rw', required => 1, lazy => 1, default => sub { {} });
has actions => (is => 'rw', required => 1, lazy => 1, default => sub { {} });
+around new => sub {
+ my ($orig, $self, $params) = @_;
+ $orig->($self, (ref($params) ? $params : { part => $params } ));
+};
+
no Moose;
-sub new {
- my ($self, $params) = @_;
- $params = { part => $params } unless ref $params;
- $self->next::method($params);
-}
-
-
sub get_action {
my ( $self, $name ) = @_;
return $self->actions->{$name} if defined $self->actions->{$name};
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Base.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Base.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Base.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,9 +1,7 @@
package Catalyst::Base;
-use MRO::Compat;
-use mro 'c3';
+use base qw/Catalyst::Controller/;
use Moose;
-BEGIN{ extends qw/Catalyst::Controller/ };
no Moose;
1;
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Component.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Component.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Component.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,16 +1,12 @@
package Catalyst::Component;
-use MRO::Compat;
-use mro 'c3';
use Moose;
use MooseX::Adopt::Class::Accessor::Fast;
use Catalyst::Utils;
-
with 'MooseX::Emulate::Class::Accessor::Fast';
with 'Catalyst::ClassData';
-no Moose;
=head1 NAME
@@ -57,32 +53,24 @@
__PACKAGE__->mk_classdata($_) for qw/_config _plugins/;
-sub new {
- my ( $self, $c ) = @_;
+around new => sub {
+ my ( $orig, $self) = @_;
# 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 );
- $self->next::method( $args );
-}
+ $self->$orig( $args );
+};
+no Moose;
+
sub COMPONENT {
my ( $self, $c ) = @_;
# Temporary fix, some components does not pass context to constructor
my $arguments = ( ref( $_[-1] ) eq 'HASH' ) ? $_[-1] : {};
-
-
- #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);
+ return $self->new($c, $arguments);
}
sub config {
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Controller.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Controller.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,8 +1,6 @@
package Catalyst::Controller;
#switch to BEGIN { extends qw/ ... /; } ?
-use MRO::Compat;
-use mro 'c3';
use base qw/Catalyst::Component Catalyst::AttrContainer/;
use Moose;
@@ -124,13 +122,14 @@
return !@{ $c->error };
}
-sub new {
+around new => sub {
+ my $orig = shift;
my $self = shift;
my $app = $_[0];
- my $new = $self->next::method(@_);
+ my $new = $self->$orig(@_);
$new->_application( $app );
return $new;
-}
+};
sub action_for {
my ( $self, $name ) = @_;
@@ -147,7 +146,7 @@
if( ref($self) ){
return $self->$orig if $self->has_action_namespace;
- } else {
+ } else {
return $self->config->{namespace} if exists $self->config->{namespace};
}
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Chained.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Chained.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Chained.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst::DispatchType::Chained;
-use MRO::Compat;
-use mro 'c3';
use Moose;
extends 'Catalyst::DispatchType';
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Default.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Default.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Default.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst::DispatchType::Default;
-use MRO::Compat;
-use mro 'c3';
use Moose;
extends 'Catalyst::DispatchType';
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Index.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Index.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Index.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst::DispatchType::Index;
-use MRO::Compat;
-use mro 'c3';
use Moose;
extends 'Catalyst::DispatchType';
no Moose;
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Path.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Path.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Path.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst::DispatchType::Path;
-use MRO::Compat;
-use mro 'c3';
use Moose;
extends 'Catalyst::DispatchType';
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Regex.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Regex.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType/Regex.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst::DispatchType::Regex;
-use MRO::Compat;
-use mro 'c3';
use Moose;
extends 'Catalyst::DispatchType::Path';
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/DispatchType.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst::DispatchType;
-use MRO::Compat;
-use mro 'c3';
use Moose; # using it to add Moose::Object to @ISA ...
no Moose;
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Dispatcher.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Dispatcher.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Dispatcher.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst::Dispatcher;
-use MRO::Compat;
-use mro 'c3';
use Moose;
use Class::MOP;
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine/CGI.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine/CGI.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine/CGI.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,14 +1,10 @@
package Catalyst::Engine::CGI;
-use MRO::Compat;
-use mro 'c3';
use Moose;
extends 'Catalyst::Engine';
has env => (is => 'rw');
-no Moose;
-
=head1 NAME
Catalyst::Engine::CGI - The CGI Engine
@@ -176,14 +172,15 @@
=cut
-sub prepare_query_parameters {
+around prepare_query_parameters => sub {
+ my $orig = shift;
my ( $self, $c ) = @_;
local (*ENV) = $self->env || \%ENV;
if ( $ENV{QUERY_STRING} ) {
- $self->next::method( $c, $ENV{QUERY_STRING} );
+ $self->$orig( $c, $ENV{QUERY_STRING} );
}
-}
+};
=head2 $self->prepare_request($c, (env => \%env))
@@ -203,10 +200,10 @@
=cut
-sub prepare_write {
+around prepare_write => sub {
*STDOUT->autoflush(1);
- return shift->next::method(@_);
-}
+ return shift->(@_);
+};
=head2 $self->write($c, $buffer)
@@ -214,7 +211,8 @@
=cut
-sub write {
+around write => sub {
+ my $orig = shift;
my ( $self, $c, $buffer ) = @_;
# Prepend the headers if they have not yet been sent
@@ -222,8 +220,8 @@
$buffer = $headers . $buffer;
}
- return $self->next::method( $c, $buffer );
-}
+ return $self->$orig( $c, $buffer );
+};
=head2 $self->read_chunk($c, $buffer, $length)
@@ -255,5 +253,6 @@
the same terms as Perl itself.
=cut
+no Moose;
1;
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine/FastCGI.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine/FastCGI.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine/FastCGI.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst::Engine::FastCGI;
-use MRO::Compat;
-use mro 'c3';
use Moose;
extends 'Catalyst::Engine::CGI';
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine/HTTP/Restarter.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine/HTTP/Restarter.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine/HTTP/Restarter.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,14 +1,12 @@
package Catalyst::Engine::HTTP::Restarter;
-use MRO::Compat;
-use mro 'c3';
use Moose;
extends 'Catalyst::Engine::HTTP';
-no Moose;
use Catalyst::Engine::HTTP::Restarter::Watcher;
-sub run {
+around run => sub {
+ my $orig = shift;
my ( $self, $class, $port, $host, $options ) = @_;
$options ||= {};
@@ -69,7 +67,8 @@
}
}
- return $self->next::method( $class, $port, $host, $options );
+ return $self->$orig( $class, $port, $host, $options );
+ no Moose;
};
1;
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine/HTTP.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine/HTTP.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine/HTTP.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,10 +1,7 @@
package Catalyst::Engine::HTTP;
-use MRO::Compat;
-use mro 'c3';
use Moose;
extends 'Catalyst::Engine::CGI';
-no Moose;
use Data::Dump qw(dump);
use Errno 'EWOULDBLOCK';
@@ -87,22 +84,22 @@
=cut
-sub finalize_read {
+around finalize_read => sub {
# 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(@_);
-}
+ shift->(@_);
+};
=head2 $self->prepare_read($c)
=cut
-sub prepare_read {
+around prepare_read => sub {
# Set the input handle to non-blocking
*STDIN->blocking(0);
- shift->next::method(@_);
-}
+ shift->(@_);
+};
=head2 $self->read_chunk($c, $buffer, $length)
@@ -144,7 +141,8 @@
=cut
-sub write {
+around write => sub {
+ my $orig = shift;
my ( $self, $c, $buffer ) = @_;
# Avoid 'print() on closed filehandle Remote' warnings when using IE
@@ -155,7 +153,7 @@
$buffer = $headers . $buffer;
}
- my $ret = $self->next::method($c, $buffer);
+ my $ret = $self->$orig($c, $buffer);
if ( !defined $ret ) {
$self->{_write_error} = $!;
@@ -166,7 +164,7 @@
}
return $ret;
-}
+};
=head2 run
@@ -529,6 +527,8 @@
sub _inet_addr { unpack "N*", inet_aton( $_[0] ) }
+no Moose;
+
=head1 SEE ALSO
L<Catalyst>, L<Catalyst::Engine>.
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Engine.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst::Engine;
-use MRO::Compat;
-use mro 'c3';
use Moose;
with 'MooseX::Emulate::Class::Accessor::Fast';
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Log.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Log.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Log.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst::Log;
-use MRO::Compat;
-use mro 'c3';
use Moose;
use Data::Dump;
@@ -14,6 +12,7 @@
{
my @levels = qw[ debug info warn error fatal ];
+ my $meta = __PACKAGE__->meta;
for ( my $i = 0 ; $i < @levels ; $i++ ) {
my $name = $levels[$i];
@@ -21,29 +20,28 @@
$LEVELS{$name} = $level;
- no strict 'refs';
-
- *{$name} = sub {
+ $meta->add_method($name, sub {
my $self = shift;
if ( $self->level & $level ) {
$self->_log( $name, @_ );
}
- };
+ });
- *{"is_$name"} = sub {
+ $meta->add_method("is_$name", sub {
my $self = shift;
return $self->level & $level;
- };
+ });;
}
}
-sub new {
+around new => sub {
+ my $orig = shift;
my $class = shift;
- my $self = $class->next::method;
+ my $self = $class->$orig;
$self->levels( scalar(@_) ? @_ : keys %LEVELS );
return $self;
-}
+};
sub levels {
my ( $self, @levels ) = @_;
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Model.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Model.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Model.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst::Model;
-use MRO::Compat;
-use mro 'c3';
use Moose;
extends qw/Catalyst::Component/;
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Request/Upload.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Request/Upload.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Request/Upload.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst::Request::Upload;
-use MRO::Compat;
-use mro 'c3';
use Moose;
use Catalyst::Exception;
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Request.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Request.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Request.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst::Request;
-use MRO::Compat;
-use mro 'c3';
use IO::Socket qw[AF_INET inet_aton];
use Carp;
use utf8;
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Response.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Response.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/Response.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst::Response;
-use MRO::Compat;
-use mro 'c3';
use Moose;
use HTTP::Headers;
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/View.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/View.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst/View.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst::View;
-use MRO::Compat;
-use mro 'c3';
use Moose;
extends qw/Catalyst::Component/;
Modified: Catalyst-Runtime/5.80/branches/moose/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/moose/lib/Catalyst.pm 2008-05-28 01:42:55 UTC (rev 7826)
+++ Catalyst-Runtime/5.80/branches/moose/lib/Catalyst.pm 2008-05-28 02:42:31 UTC (rev 7827)
@@ -1,7 +1,5 @@
package Catalyst;
-use MRO::Compat;
-use mro 'c3';
use Moose;
extends 'Catalyst::Component';
use bytes;
@@ -41,8 +39,6 @@
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 || [] }; }
@@ -376,19 +372,20 @@
=cut
-sub stash {
+around stash => sub {
+ my $orig = shift;
my $c = shift;
+ my $stash = $orig->($c);
if (@_) {
- my $stash = @_ > 1 ? {@_} : $_[0];
- croak('stash takes a hash or hashref') unless ref $stash;
- foreach my $key ( keys %$stash ) {
- #shouldn't we hold this in a var and save ourselves the subcall?
- $c->next::method->{$key} = $stash->{$key};
+ my $new_stash = @_ > 1 ? {@_} : $_[0];
+ croak('stash takes a hash or hashref') unless ref $new_stash;
+ foreach my $key ( keys %$new_stash ) {
+ $stash->{$key} = $new_stash->{$key};
}
}
- return $c->next::method;
-}
+ return $stash;
+};
=head2 $c->error
@@ -701,14 +698,15 @@
=cut
-sub config {
+around config => sub {
+ my $orig = shift;
my $c = shift;
$c->log->warn("Setting config after setup has been run is not a good idea.")
if ( @_ and $c->setup_finished );
- $c->next::method(@_);
-}
+ $c->$orig(@_);
+};
=head2 $c->log
@@ -814,7 +812,6 @@
sub setup {
my ( $class, @arguments ) = @_;
- Class::C3::initialize;
$class->log->warn("Running setup twice is not a good idea.")
if ( $class->setup_finished );
@@ -936,7 +933,6 @@
$class->log->_flush() if $class->log->can('_flush');
$class->setup_finished(1);
- Class::C3::initialize;
}
=head2 $c->uri_for( $path, @args?, \%query_values? )
@@ -2451,4 +2447,6 @@
=cut
+no Moose;
+
1;
More information about the Catalyst-commits
mailing list