X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=b9cf01ca5a634f6d08b7cb63401c341409ed98f7;hp=73c63fbbb14b7608eff0554da0ca6519d0ed51f2;hb=fb34eb9c063c53abd061d260a30f0ca7c57a0833;hpb=d7132282d25c185464071a282db8b83a2b218b3f diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 73c63fb..b9cf01c 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -81,7 +81,7 @@ __PACKAGE__->stats_class('Catalyst::Stats'); # Remember to update this in Catalyst::Runtime as well! -our $VERSION = '5.80024'; +our $VERSION = '5.80025'; sub import { my ( $class, @arguments ) = @_; @@ -894,7 +894,7 @@ component is constructed. For example: MyApp->config({ 'Model::Foo' => { bar => 'baz', overrides => 'me' } }); - MyApp::Model::Foo->config({ quux => 'frob', 'overrides => 'this' }); + MyApp::Model::Foo->config({ quux => 'frob', overrides => 'this' }); will mean that C receives the following data when constructed: @@ -905,6 +905,21 @@ constructed: overrides => 'me', }); +It's common practice to use a Moose attribute +on the receiving component to access the config value. + + package MyApp::Model::Foo; + + use Moose; + + # this attr will receive 'baz' at construction time + has 'bar' => ( + is => 'rw', + isa => 'Str', + ); + +You can then get the value 'baz' by calling $c->model('Foo')->bar + =cut around config => sub { @@ -1229,7 +1244,9 @@ sub setup_finalize { Constructs an absolute L object based on the application root, the provided path, and the additional arguments and query parameters provided. -When used as a string, provides a textual URI. +When used as a string, provides a textual URI. If you need more flexibility +than this (i.e. the option to provide relative URIs etc.) see +L. If no arguments are provided, the URI for the current action is returned. To return the current action and also provide @args, use @@ -2401,8 +2418,7 @@ sub setup_components { my $config = $class->config->{ setup_components }; - my @comps = sort { length $a <=> length $b } - $class->locate_components($config); + my @comps = $class->locate_components($config); my %comps = map { $_ => 1 } @comps; my $deprecatedcatalyst_component_names = grep { /::[CMV]::/ } @comps; @@ -2457,7 +2473,8 @@ sub locate_components { %$config ); - my @comps = $locator->plugins; + # XXX think about ditching this sort entirely + my @comps = sort { length $a <=> length $b } $locator->plugins; return @comps; } @@ -2594,7 +2611,7 @@ sub setup_engine { } if ($ENV{MOD_PERL}) { - use Catalyst::Engine::Loader; + require 'Catalyst/Engine/Loader.pm'; my $apache = Catalyst::Engine::Loader->auto; # FIXME - Immutable $class->meta->add_method(handler => sub { @@ -3146,6 +3163,8 @@ wreis: Wallace Reis Yuval Kogman, C +rainboxx: Matthias Dietrich, C + =head1 LICENSE This library is free software. You can redistribute it and/or modify it under