X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=8480fca3450b072bbcd3c819277b1c21f2f3af49;hp=2bbe8d6eb8f2db14e4344b8e14757ef62c6e8a4a;hb=3fb903fd7b2a932d4a124dbb3c364275b665858d;hpb=e9e51b8f5b806e77bb66f8528a831b291bcd7295 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 2bbe8d6..8480fca 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -5,6 +5,7 @@ package Catalyst; use Class::C3; use Moose; +use Class::MOP::Object (); extends 'Catalyst::Component'; use bytes; use Catalyst::Exception; @@ -80,7 +81,7 @@ __PACKAGE__->stats_class('Catalyst::Stats'); # Remember to update this in Catalyst::Runtime as well! -our $VERSION = '5.8000_03'; +our $VERSION = '5.8000_04'; sub import { my ( $class, @arguments ) = @_; @@ -1077,7 +1078,7 @@ sub uri_for { # join args with '/', or a blank string my $args = join('/', grep { defined($_) } @args); $args =~ s/\?/%3F/g; # STUPID STUPID SPECIAL CASE - $args =~ s!^/!!; + $args =~ s!^/+!!; my $base = $c->req->base; my $class = ref($base); $base =~ s{(?log->debug(qq/Redirecting to "$location"/) if $c->debug; $response->header( Location => $location ); - #Moose TODO: we should probably be using a predicate method here ? - if ( !$response->body ) { + if ( !$response->has_body ) { # Add a default body if none is already present $response->body( qq{

This item has moved here.

} @@ -2082,9 +2082,10 @@ sub setup_engine { } if ( $ENV{MOD_PERL} ) { - + my $meta = $class->Class::MOP::Object::meta(); + # create the apache method - $class->meta->add_method('apache' => sub { shift->engine->apache }); + $meta->add_method('apache' => sub { shift->engine->apache }); my ( $software, $version ) = $ENV{MOD_PERL} =~ /^(\S+)\/(\d+(?:[\.\_]\d+)+)/; @@ -2216,7 +2217,7 @@ sub setup_log { my $env_debug = Catalyst::Utils::env_value( $class, 'DEBUG' ); if ( defined($env_debug) ? $env_debug : $debug ) { - $class->meta->add_method('debug' => sub { 1 }); + $class->Class::MOP::Object::meta()->add_method('debug' => sub { 1 }); $class->log->debug('Debug messages enabled'); } } @@ -2240,7 +2241,7 @@ sub setup_stats { my $env = Catalyst::Utils::env_value( $class, 'STATS' ); if ( defined($env) ? $env : ($stats || $class->debug ) ) { - $class->meta->add_method('use_stats' => sub { 1 }); + $class->Class::MOP::Object::meta()->add_method('use_stats' => sub { 1 }); $class->log->debug('Statistics enabled'); } } @@ -2283,9 +2284,9 @@ the plugin name does not begin with C. $proto->_plugins->{$plugin} = 1; unless ($instant) { no strict 'refs'; - if( $class->can('meta') ){ - my @superclasses = ($plugin, $class->meta->superclasses ); - $class->meta->superclasses(@superclasses); + if ( my $meta = $class->Class::MOP::Object::meta() ) { + my @superclasses = ($plugin, $meta->superclasses ); + $meta->superclasses(@superclasses); } else { unshift @{"$class\::ISA"}, $plugin; }