X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst.pm;h=f80f8a12beb06f6f5f5d377f28a15e3e20b15c36;hb=f8a54681762e3fa6b09dce9f44ba40f82cacc70a;hp=1c9676364742671f744677c0842684bb06c99699;hpb=e9ba5c119a81f59f8339cd5c749709f5bc56b6d6;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 1c96763..f80f8a1 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -77,17 +77,8 @@ __PACKAGE__->request_class('Catalyst::Request'); __PACKAGE__->response_class('Catalyst::Response'); __PACKAGE__->stats_class('Catalyst::Stats'); -# This is here as but we need to be able to call# C::C->action_class, which -# calls the ->_action_class attribute's accessor to get the default action -# class for this controller. As the app class is also a controller (eww, warns) -# but we don't have an instance (just the component name) in the registery, -# we override _action_class here so that $class->_action_class doesn't explode -# (so it becomes class data rather than instance data for this one special case). -# This is a gross back compat hack which can go away for app/ctx split. -__PACKAGE__->mk_classdata(qw/ _action_class /); -__PACKAGE__->_action_class('Catalyst::Action'); - # Remember to update this in Catalyst::Runtime as well! + our $VERSION = '5.80024'; sub import { @@ -912,6 +903,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 { @@ -1163,7 +1169,7 @@ EOF # Add our self to components, since we are also a component if( $class->isa('Catalyst::Controller') ){ - $class->components->{$class} = $class; # HATEFUL SPECIAL CASE + $class->components->{$class} = $class; } $class->setup_actions; @@ -1766,7 +1772,7 @@ sub finalize { $c->log_response; if ($c->use_stats) { - my $elapsed = $c->stats->elapsed; + my $elapsed = sprintf '%f', $c->stats->elapsed; my $av = $elapsed == 0 ? '??' : sprintf '%.3f', 1 / $elapsed; $c->log->info( "Request took ${elapsed}s ($av/s)\n" . $c->stats->report . "\n" ); @@ -3192,6 +3198,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