X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=ea7117a7fe4d33b63d6c9814b027092a1ff88ccb;hb=c45c5d3787dfb147d4bfb4542283f52a3223fa87;hp=4cf485d0e99a0685744f7dab227f139c86aef751;hpb=cc95842fedcac58b2dc12c6ce547e22d3170351c;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 4cf485d..ea7117a 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -24,7 +24,7 @@ use Tree::Simple qw/use_weak_refs/; use Tree::Simple::Visitor::FindByUID; use attributes; use utf8; -use Carp qw/croak/; +use Carp qw/croak carp/; BEGIN { require 5.008001; } @@ -61,7 +61,7 @@ __PACKAGE__->response_class('Catalyst::Response'); # Remember to update this in Catalyst::Runtime as well! -our $VERSION = '5.7006'; +our $VERSION = '5.7007'; sub import { my ( $class, @arguments ) = @_; @@ -87,6 +87,9 @@ Catalyst - The Elegant MVC Web Application Framework =head1 SYNOPSIS +See the L distribution for comprehensive +documentation and tutorials. + # Install Catalyst::Devel for helpers and other development tools # use the helper to create a new application catalyst.pl MyApp @@ -356,7 +359,7 @@ sub stash { Returns an arrayref containing error messages. If Catalyst encounters an error while processing a request, it stores the error in $c->error. This -method should not be used to store non-fatal error messages. +method should only be used to store fatal error messages. my @error = @{ $c->error }; @@ -508,6 +511,8 @@ Gets a L instance by name. $c->model('Foo')->do_stuff; +Any extra arguments are directly passed to ACCEPT_CONTEXT. + If the name is omitted, it will look for - a model object in $c->stash{current_model_instance}, then - a model name in $c->stash->{current_model}, then @@ -526,10 +531,10 @@ sub model { if $c->stash->{current_model_instance}; return $c->model( $c->stash->{current_model} ) if $c->stash->{current_model}; - return $c->model( $c->config->{default_model} ) - if $c->config->{default_model}; } - return $c->_filter_component( $c->_comp_singular(qw/Model M/), @args ); + return $c->model( $c->config->{default_model} ) + if $c->config->{default_model}; + return $c->_filter_component( $c->_comp_singular(qw/Model M/) ); } @@ -551,6 +556,8 @@ Gets a L instance by name. $c->view('Foo')->do_stuff; +Any extra arguments are directly passed to ACCEPT_CONTEXT. + If the name is omitted, it will look for - a view object in $c->stash{current_view_instance}, then - a view name in $c->stash->{current_view}, then @@ -569,9 +576,9 @@ sub view { if $c->stash->{current_view_instance}; return $c->view( $c->stash->{current_view} ) if $c->stash->{current_view}; - return $c->view( $c->config->{default_view} ) - if $c->config->{default_view}; } + return $c->view( $c->config->{default_view} ) + if $c->config->{default_view}; return $c->_filter_component( $c->_comp_singular(qw/View V/) ); } @@ -942,7 +949,13 @@ sub uri_for { }; # join args with '/', or a blank string - my $args = ( scalar @args ? '/' . join( '/', map {s/\?/%3F/g; $_} @args ) : '' ); + my $args = ( scalar @args ? '/' . join( '/', map { + unless (defined) { + carp "uri_for called with undefined argument"; + $_=''; + } + s/\?/%3F/g; $_ + } @args ) : '' ); $args =~ s/^\/// unless $path; my $res = URI->new_abs( URI->new_abs( "$path$args", "$basepath$namespace" ), $base ) @@ -1388,6 +1401,13 @@ sub finalize_headers { if ( my $location = $c->response->redirect ) { $c->log->debug(qq/Redirecting to "$location"/) if $c->debug; $c->response->header( Location => $location ); + + if ( !$c->response->body ) { + # Add a default body if none is already present + $c->response->body( + qq{

This item has moved here.

} + ); + } } # Content-Length