X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=b85ac7f3e50e124540f2b81594942d0f56a98a2a;hp=b7bb450d67408523b6e23799bfd2b3d63e7eb540;hb=80cdbbff8f7c6b6c341e367fc780d4982b1ee54e;hpb=00e6a2b71197b3b79b6d62a1c8154b7ca6702d2f diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index b7bb450..b85ac7f 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -38,14 +38,12 @@ our $DETACH = "catalyst_detach\n"; require Module::Pluggable::Fast; # Helper script generation -our $CATALYST_SCRIPT_GEN = 8; +our $CATALYST_SCRIPT_GEN = 10; __PACKAGE__->mk_classdata($_) for qw/components arguments dispatcher engine log/; -our $VERSION = '5.49_01'; - -sub version { return $Catalyst::VERSION } +our $VERSION = '5.49_02'; sub import { my ( $class, @arguments ) = @_; @@ -263,6 +261,23 @@ sub forward { my $c = shift; $c->dispatcher->forward( $c, @_ ) } Accessor to the namespace of the current action +=item $c->path_to(@path) + +Merges C<@path> with $c->config->{home} and returns a L object. + +For example: + + $c->path_to( 'db', 'sqlite.db' ); + +=cut + +sub path_to { + my ( $c, @path ) = @_; + my $path = dir( $c->config->{home}, @path ); + if ( -d $path ) { return $path } + else { return file( $c->config->{home}, @path ) } +} + =item $c->setup Setup. @@ -411,6 +426,7 @@ sub uri_for { # massage match, empty if absolute path $match =~ s/^\///; $match .= '/' if $match; + $path ||= ''; $match = '' if $path =~ /^\//; $path =~ s/^\///; @@ -560,20 +576,24 @@ sub welcome_message { my $name = $c->config->{name}; my $logo = $c->uri_for('/static/images/catalyst_logo.png'); my $prefix = Catalyst::Utils::appprefix( ref $c ); + $c->response->content_type('text/html; charset=utf-8'); return <<"EOF"; - + + + + $name on Catalyst $VERSION