[Catalyst-commits] r11149 - in Catalyst-Runtime/5.80/trunk: . lib
lib/Catalyst t/aggregate t/lib/TestApp/Action
t/lib/TestApp/Controller
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Mon Aug 17 23:14:38 GMT 2009
Author: t0m
Date: 2009-08-17 23:14:38 +0000 (Mon, 17 Aug 2009)
New Revision: 11149
Modified:
Catalyst-Runtime/5.80/trunk/Changes
Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Action.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm
Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm
Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_anon.t
Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Action/TestMyAction.pm
Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Anon.pm
Log:
Switch to catalyst_component_name
Modified: Catalyst-Runtime/5.80/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.80/trunk/Changes 2009-08-17 22:24:46 UTC (rev 11148)
+++ Catalyst-Runtime/5.80/trunk/Changes 2009-08-17 23:14:38 UTC (rev 11149)
@@ -34,7 +34,7 @@
expand_component_module (rjbs)
- Allow Components to return anon classed from their COMPONENT method
correctly, and have action registration work on Controllers returned
- as such by adding a _component_name accessor for all components
+ as such by adding a catalyst_component_name accessor for all components
which returns the component instance's name to be used when building
actions etc.
- Adding X-Forwarded-Port to allow the frontend proxy to dictate the
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Action.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Action.pm 2009-08-17 22:24:46 UTC (rev 11148)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Action.pm 2009-08-17 23:14:38 UTC (rev 11149)
@@ -104,7 +104,7 @@
=head2 class
Returns the name of the component where this action is defined.
-Derived by calling the L<Catalyst::Component/_component_name|_component_name>
+Derived by calling the L<Catalyst::Component/catalyst_component_name|catalyst_component_name>
method on each component.
=head2 code
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm 2009-08-17 22:24:46 UTC (rev 11148)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Component.pm 2009-08-17 23:14:38 UTC (rev 11149)
@@ -60,15 +60,15 @@
__PACKAGE__->mk_classdata('_plugins');
__PACKAGE__->mk_classdata('_config');
-has _component_name => ( is => 'ro' ); # Cannot be required => 1 as context
+has catalyst_component_name => ( is => 'ro' ); # Cannot be required => 1 as context
# class @ISA component - HATE
# Make accessor callable as a class method, as we need to call setup_actions
# on the application class, which we don't have an instance of, ewwwww
# Also, naughty modules like Catalyst::View::JSON try to write to _everything_,
# so spit a warning, ignore that (and try to do the right thing anyway) here..
-around _component_name => sub {
+around catalyst_component_name => sub {
my ($orig, $self) = (shift, shift);
- Carp::cluck("Tried to write to the _component_name accessor - is your component broken or just mad? (Write ignored - using default value.)") if scalar @_;
+ Carp::cluck("Tried to write to the catalyst_component_name accessor - is your component broken or just mad? (Write ignored - using default value.)") if scalar @_;
blessed($self) ? $self->$orig() || blessed($self) : $self;
};
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm 2009-08-17 22:24:46 UTC (rev 11148)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst/Controller.pm 2009-08-17 23:14:38 UTC (rev 11149)
@@ -158,7 +158,7 @@
}
}
- my $namespace = Catalyst::Utils::class2prefix($self->_component_name, $case_s) || '';
+ my $namespace = Catalyst::Utils::class2prefix($self->catalyst_component_name, $case_s) || '';
$self->$orig($namespace) if ref($self);
return $namespace;
};
@@ -209,7 +209,7 @@
sub register_action_methods {
my ( $self, $c, @methods ) = @_;
- my $class = $self->_component_name;
+ my $class = $self->catalyst_component_name;
#this is still not correct for some reason.
my $namespace = $self->action_namespace($c);
Modified: Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2009-08-17 22:24:46 UTC (rev 11148)
+++ Catalyst-Runtime/5.80/trunk/lib/Catalyst.pm 2009-08-17 23:14:38 UTC (rev 11149)
@@ -2154,10 +2154,10 @@
my @comps = sort { length $a <=> length $b }
$class->locate_components($config);
- my $deprecated_component_names = grep { /::[CMV]::/ } @comps;
+ my $deprecatedcatalyst_component_names = grep { /::[CMV]::/ } @comps;
$class->log->warn(qq{Your application is using the deprecated ::[MVC]:: type naming scheme.\n}.
qq{Please switch your class names to ::Model::, ::View:: and ::Controller: as appropriate.\n}
- ) if $deprecated_component_names;
+ ) if $deprecatedcatalyst_component_names;
for my $component ( @comps ) {
@@ -2251,10 +2251,10 @@
my $suffix = Catalyst::Utils::class2classsuffix( $component );
my $config = $class->config->{ $suffix } || {};
- # Stash _component_name in the config here, so that custom COMPONENT
+ # Stash catalyst_component_name in the config here, so that custom COMPONENT
# methods also pass it. local to avoid pointlessly shitting in config
# for the debug screen, as $component is already the key name.
- local $config->{_component_name} = $component;
+ local $config->{catalyst_component_name} = $component;
my $instance = eval { $component->COMPONENT( $class, $config ); };
Modified: Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_anon.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_anon.t 2009-08-17 22:24:46 UTC (rev 11148)
+++ Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_anon.t 2009-08-17 23:14:38 UTC (rev 11149)
@@ -11,13 +11,13 @@
my $response = request('http://localhost/anon/test');
ok($response->is_success);
is($response->header('X-Component-Name-Action'),
- 'TestApp::Controller::Anon', 'Action can see correct _component_name');
+ 'TestApp::Controller::Anon', 'Action can see correct catalyst_component_name');
isnt($response->header('X-Component-Instance-Name-Action'),
- 'TestApp::Controller::Anon', 'ref($controller) ne _component_name');
+ 'TestApp::Controller::Anon', 'ref($controller) ne catalyst_component_name');
is($response->header('X-Component-Name-Controller'),
- 'TestApp::Controller::Anon', 'Controller can see correct _component_name');
+ 'TestApp::Controller::Anon', 'Controller can see correct catalyst_component_name');
is($response->header('X-Class-In-Action'),
- 'TestApp::Controller::Anon', '$action->class is _component_name');
+ 'TestApp::Controller::Anon', '$action->class is catalyst_component_name');
is($response->header('X-Anon-Trait-Applied'),
'1', 'Anon controller class has trait applied correctly');
}
Modified: Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Action/TestMyAction.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Action/TestMyAction.pm 2009-08-17 22:24:46 UTC (rev 11148)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Action/TestMyAction.pm 2009-08-17 23:14:38 UTC (rev 11149)
@@ -9,7 +9,7 @@
my $self = shift;
my ( $controller, $c, $test ) = @_;
$c->res->header( 'X-TestAppActionTestMyAction', 'MyAction works' );
- $c->res->header( 'X-Component-Name-Action', $controller->_component_name);
+ $c->res->header( 'X-Component-Name-Action', $controller->catalyst_component_name);
$c->res->header( 'X-Component-Instance-Name-Action', ref($controller));
$c->res->header( 'X-Class-In-Action', $self->class);
$self->next::method(@_);
Modified: Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Anon.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Anon.pm 2009-08-17 22:24:46 UTC (rev 11148)
+++ Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Anon.pm 2009-08-17 23:14:38 UTC (rev 11149)
@@ -32,7 +32,7 @@
sub test : Local ActionClass('+TestApp::Action::TestMyAction') {
my ($self, $c) = @_;
- $c->res->header('X-Component-Name-Controller', $self->_component_name);
+ $c->res->header('X-Component-Name-Controller', $self->catalyst_component_name);
$c->res->body('It works');
}
More information about the Catalyst-commits
mailing list