X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=26b5b75ff70b1b7b1189db97904553d7f7f2e9ca;hp=2bbe8d6eb8f2db14e4344b8e14757ef62c6e8a4a;hb=8a440eba91ace539964b76901ad0e9274ece4ec6;hpb=e9e51b8f5b806e77bb66f8528a831b291bcd7295 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 2bbe8d6..26b5b75 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; @@ -33,7 +34,8 @@ use Carp qw/croak carp/; BEGIN { require 5.008001; } -has stack => (is => 'rw', default => sub { [] }); +# FIXME lazy => 1 here makes C::P::Auth tests pass?!? +has stack => (is => 'ro', default => sub { [] }); has stash => (is => 'rw', default => sub { {} }); has state => (is => 'rw', default => 0); has stats => (is => 'rw'); @@ -80,7 +82,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 ) = @_; @@ -261,7 +263,9 @@ MYAPP_WEB_HOME. If both variables are set, the MYAPP_HOME one will be used. =head2 -Log -Specifies log level. + use Catalyst '-Log=warn,fatal,error'; + +Specifies a comma-delimited list of log levels. =head2 -Stats @@ -1077,7 +1081,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 +2085,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+)+)/; @@ -2203,20 +2207,35 @@ sub setup_home { =head2 $c->setup_log -Sets up log. +Sets up log by instantiating a L