[Catalyst-commits] r13496 - in Catalyst-Runtime/5.80/branches/psgi: . lib lib/Catalyst lib/Catalyst/Script t t/lib t/lib/TestApp/Controller/Moose

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Mon Aug 16 18:31:59 GMT 2010


Author: t0m
Date: 2010-08-16 19:31:59 +0100 (Mon, 16 Aug 2010)
New Revision: 13496

Added:
   Catalyst-Runtime/5.80/branches/psgi/t/lib/TestApp/Controller/Moose/NoAttributes.pm
   Catalyst-Runtime/5.80/branches/psgi/t/unit_core_methodattributes_method_metaclass_on_subclasses.t
Modified:
   Catalyst-Runtime/5.80/branches/psgi/
   Catalyst-Runtime/5.80/branches/psgi/Changes
   Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst.pm
   Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Component.pm
   Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Controller.pm
   Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Engine.pm
   Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Runtime.pm
   Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Script/Server.pm
   Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Utils.pm
   Catalyst-Runtime/5.80/branches/psgi/t/custom_exception_class_simple.t
   Catalyst-Runtime/5.80/branches/psgi/t/lib/TestAppClassExceptionSimpleTest.pm
Log:
 r15645 at spaceinvaders (orig r13336):  t0m | 2010-06-10 10:54:11 +0100
 Fix $self vs $class, davewood++
 r15660 at spaceinvaders (orig r13351):  rainboxx | 2010-06-15 12:53:05 +0100
 Applied doc patches that might help to figure out how to receive component's config values.
 r15672 at spaceinvaders (orig r13363):  jester | 2010-06-22 21:47:45 +0100
 Fixed typo
 
 r15674 at spaceinvaders (orig r13365):  bricas | 2010-06-24 13:52:20 +0100
 add typo fix to Changes
 r15689 at spaceinvaders (orig r13380):  arcanez | 2010-07-03 01:04:07 +0100
 remove extra '
 r15716 at spaceinvaders (orig r13407):  hobbs | 2010-07-09 10:40:44 +0100
 Try harder to make finalize_error encoding-safe.
 
 r15750 at spaceinvaders (orig r13441):  t0m | 2010-07-28 22:39:41 +0100
  r15666 at spaceinvaders (orig r13357):  jnapiorkowski | 2010-06-16 20:12:46 +0100
  new branch
  r15667 at spaceinvaders (orig r13358):  jnapiorkowski | 2010-06-16 20:55:08 +0100
  broke out and documented action_class method
  r15749 at spaceinvaders (orig r13440):  t0m | 2010-07-28 22:39:32 +0100
  Changelog
 
 r15755 at spaceinvaders (orig r13446):  t0m | 2010-07-28 23:00:14 +0100
  r15662 at spaceinvaders (orig r13353):  t0m | 2010-06-15 22:15:31 +0100
  Branch for rt58057
  
  r15663 at spaceinvaders (orig r13354):  t0m | 2010-06-15 22:17:32 +0100
  Commit standalone test, test which makes the TestApp blow up and the nasty workaround
  r15726 at spaceinvaders (orig r13417):  t0m | 2010-07-23 13:29:21 +0100
  I know hobbs has a patch to add a load of these, but we should at least add (es)
  r15753 at spaceinvaders (orig r13444):  t0m | 2010-07-28 22:56:25 +0100
  Entirely the wrong branch, idiot. Remove r13417
  r15754 at spaceinvaders (orig r13445):  t0m | 2010-07-28 23:00:05 +0100
  Document the horrible, changelog. I'm going to merge this and fix a real issue as I don't have time to fuck around inside Moose right now and it's been waiting way too long already
 
 r15756 at spaceinvaders (orig r13447):  t0m | 2010-07-28 23:26:21 +0100
 Fix TODO tests.
 r15757 at spaceinvaders (orig r13448):  t0m | 2010-07-28 23:26:31 +0100
 Whitespace
 r15760 at spaceinvaders (orig r13451):  t0m | 2010-07-28 23:53:56 +0100
  r13095 at spaceinvaders (orig r13059):  caelum | 2010-03-22 09:27:45 +0000
  branch to fix running under CGI on IIS
  r13097 at spaceinvaders (orig r13061):  caelum | 2010-03-22 10:40:52 +0000
  fix for CGI on IIS
  r15759 at spaceinvaders (orig r13450):  t0m | 2010-07-28 23:52:15 +0100
  Changelog
 
 r15764 at spaceinvaders (orig r13455):  t0m | 2010-07-29 01:58:32 +0100
 Version 5.80025
 r15766 at spaceinvaders (orig r13457):  zarquon | 2010-07-29 11:26:51 +0100
 advertise Catalyst::Plugin::SmartURI
 r15767 at spaceinvaders (orig r13458):  zarquon | 2010-07-29 11:28:09 +0100
 stupid typo
 r15777 at spaceinvaders (orig r13468):  lukes | 2010-08-04 15:25:18 +0100
 moved component name sort that happens in setup_components to locate_components to allow methods to wrap around locate_components
 r15779 at spaceinvaders (orig r13470):  rbuels | 2010-08-04 21:04:14 +0100
 don't load Catalyst::Exception in Utils.pm BEGIN, because some Scripts::* load Utils before MyApp.pm, meaning that ::Exception::CATALYST_EXCEPTION_CLASS in MyApp.pm will not be respected



Property changes on: Catalyst-Runtime/5.80/branches/psgi
___________________________________________________________________
Modified: svk:merge
   - 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/compres:7999
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/context_go:8001
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/trunk:8533
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/Catalyst-Test-Updates:8363
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/add_captures_to_visit:9546
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/aggregate_more:11803
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/better_scripts:12074
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/disable_regex_fallback:11456
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/fix_path_info_decoding:12089
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/fix_request_uri:13262
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/index_default_fuckage:10646
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/moose:7911
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/more_metaclass_compat:13280
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/namespace_handling_refactor:10655
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/param_filtering:13012
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/uri_encode_captures_andor_args_take2:11811
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/uri_for_utf8:12834
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/trunk:13297
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-ChildOf:4443
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-Runtime-jrockway:5857
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-component-setup:4320
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-docs:4325
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/current/Catalyst-Runtime:5142
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst:4483
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst-Runtime:6165
6d45476b-5895-46b8-b13a-8b969fa34c98:/local/Catalyst-Runtime-better_scripts:11331
6d45476b-5895-46b8-b13a-8b969fa34c98:/local/Catalyst-Runtime-mech_tests:15583
6d45476b-5895-46b8-b13a-8b969fa34c98:/local/Catalyst-Runtime-psgi:15606
8a9521aa-ff93-41d6-9f87-b05cafcdab40:/local/cat/Catalyst-Runtime/5.80/trunk:8157
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime:8339
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime-jrockway:8342
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime:6511
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime-current:10442
   + 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/compres:7999
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/context_go:8001
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/trunk:8533
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/Catalyst-Test-Updates:8363
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/add_captures_to_visit:9546
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/aggregate_more:11803
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/better_scripts:12074
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/disable_regex_fallback:11456
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/fix_iis_cgi:13450
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/fix_path_info_decoding:12089
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/fix_request_uri:13262
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/index_default_fuckage:10646
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/moose:7911
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/more_metaclass_compat:13280
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/namespace_handling_refactor:10655
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/param_filtering:13012
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/rt58057:13445
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/tweak_controller_action_creation:13440
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/uri_encode_captures_andor_args_take2:11811
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/uri_for_utf8:12834
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/trunk:13470
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-ChildOf:4443
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-Runtime-jrockway:5857
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-component-setup:4320
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/Catalyst-docs:4325
4ad37cd2-5fec-0310-835f-b3785c72a374:/branches/current/Catalyst-Runtime:5142
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst:4483
4ad37cd2-5fec-0310-835f-b3785c72a374:/trunk/Catalyst-Runtime:6165
6d45476b-5895-46b8-b13a-8b969fa34c98:/local/Catalyst-Runtime-better_scripts:11331
6d45476b-5895-46b8-b13a-8b969fa34c98:/local/Catalyst-Runtime-mech_tests:15583
6d45476b-5895-46b8-b13a-8b969fa34c98:/local/Catalyst-Runtime-psgi:15606
8a9521aa-ff93-41d6-9f87-b05cafcdab40:/local/cat/Catalyst-Runtime/5.80/trunk:8157
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime:8339
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime-jrockway:8342
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime:6511
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime-current:10442

Modified: Catalyst-Runtime/5.80/branches/psgi/Changes
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/Changes	2010-08-16 18:30:53 UTC (rev 13495)
+++ Catalyst-Runtime/5.80/branches/psgi/Changes	2010-08-16 18:31:59 UTC (rev 13496)
@@ -1,12 +1,26 @@
 # This file documents the revision history for Perl extension Catalyst.
 
+5.80025 2010-07-29 01:50:00
+
+ New features:
+  - An 'action_class' method has been added to Catalyst::Controller to
+    allow controller base classes, roles or traits
+    (e.g. Catalyst::Controller::ActionRole) to more easily override
+    the default action creation.
+
  Bug fixes:
   - Fix the --mech and --mechanize options to the myapp_create.pl script
     to operate correctly by fixing the options passed down into the script.
+  - Fix controllers with no method attributes (where the action definitions
+    are entirely contained in config). RT#58057
+  - Fix running as a CGI under IIS at non-root locations.
 
  Documentation:
   - Fix missing - in the docs when describing the --mechanize option at one
     point.
+  - Explained the common practice how to access the component's config
+    values.
+  - Fixed typo in Catalyst/Script/Server.pm (RT #58474)
 
 5.80024 2010-05-15 11:55:44
 

Modified: Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Component.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Component.pm	2010-08-16 18:30:53 UTC (rev 13495)
+++ Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Component.pm	2010-08-16 18:31:59 UTC (rev 13496)
@@ -170,7 +170,7 @@
 
 C<< my $component_instance = $component->COMPONENT($app, $arguments); >>
 
-If this method is present (as it is on all Catalyst::Component subclasses,
+If this method is present (as it is on all Catalyst::Component subclasses),
 it is called by Catalyst during setup_components with the application class
 as $app and any config entry on the application for this component (for example,
 in the case of MyApp::Controller::Foo this would be
@@ -185,7 +185,7 @@
 
   sub COMPONENT {
       my ($class, $app, $args) = @_;
-      $args = $self->merge_config_hashes($self->config, $args);
+      $args = $class->merge_config_hashes($class->config, $args);
       return $class->new($app, $args);
   }
 
@@ -200,6 +200,12 @@
 will be merged with any existing config settings. Each component in
 a Catalyst application has its own config hash.
 
+The component's config hash is merged with any config entry on the
+application for this component and passed to C<new()> (as mentioned
+above at L</COMPONENT>). The common practice to access the merged
+config is to use a Moose attribute for each config entry on the
+receiving component.
+
 =head2 $c->process()
 
 This is the default method called on a Catalyst component in the dispatcher.

Modified: Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Controller.pm	2010-08-16 18:30:53 UTC (rev 13495)
+++ Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Controller.pm	2010-08-16 18:31:59 UTC (rev 13496)
@@ -225,7 +225,9 @@
 
     foreach my $method (@methods) {
         my $name = $method->name;
-        my $attributes = $method->attributes;
+        # Horrible hack! All method metaclasses should have an attributes
+        # method, core Moose bug - see r13354.
+        my $attributes = $method->can('attributes') ? $method->attributes : [];
         my $attrs = $self->_parse_attrs( $c, $name, @{ $attributes } );
         if ( $attrs->{Private} && ( keys %$attrs > 1 ) ) {
             $c->log->debug( 'Bad action definition "'
@@ -248,16 +250,25 @@
     }
 }
 
-sub create_action {
+sub action_class {
     my $self = shift;
     my %args = @_;
 
     my $class = (exists $args{attributes}{ActionClass}
-                    ? $args{attributes}{ActionClass}[0]
-                    : $self->_action_class);
+        ? $args{attributes}{ActionClass}[0]
+        : $self->_action_class);
+
     Class::MOP::load_class($class);
+    return $class;
+}
 
+sub create_action {
+    my $self = shift;
+    my %args = @_;
+
+    my $class = $self->action_class(%args);
     my $action_args = $self->config->{action_args};
+
     my %extra_args = (
         %{ $action_args->{'*'}           || {} },
         %{ $action_args->{ $args{name} } || {} },
@@ -529,6 +540,11 @@
 Creates action objects for a set of action methods using C< create_action >,
 and registers them with the dispatcher.
 
+=head2 $self->action_class(%args)
+
+Used when a controller is creating an action to determine the correct base
+action class to use.
+
 =head2 $self->create_action(%args)
 
 Called with a hash of data to be use for construction of a new

Modified: Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Engine.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Engine.pm	2010-08-16 18:30:53 UTC (rev 13495)
+++ Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Engine.pm	2010-08-16 18:31:59 UTC (rev 13496)
@@ -14,6 +14,8 @@
 use Plack::Loader;
 use Plack::Middleware::Conditional;
 use Plack::Middleware::ReverseProxy;
+use Encode ();
+use utf8;
 
 use namespace::clean -except => 'meta';
 
@@ -155,7 +157,15 @@
 
     $c->res->content_type('text/html; charset=utf-8');
     my $name = ref($c)->config->{name} || join(' ', split('::', ref $c));
+    
+    # Prevent Catalyst::Plugin::Unicode::Encoding from running.
+    # This is a little nasty, but it's the best way to be clean whether or
+    # not the user has an encoding plugin.
 
+    if ($c->can('encoding')) {
+      $c->{encoding} = '';
+    }
+
     my ( $title, $error, $infos );
     if ( $c->debug ) {
 
@@ -303,11 +313,12 @@
 </body>
 </html>
 
-
     # Trick IE. Old versions of IE would display their own error page instead
     # of ours if we'd give it less than 512 bytes.
     $c->res->{body} .= ( ' ' x 512 );
 
+    $c->res->{body} = Encode::encode("UTF-8", $c->res->{body});
+
     # Return 500
     $c->res->status(500);
 }

Modified: Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Runtime.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Runtime.pm	2010-08-16 18:30:53 UTC (rev 13495)
+++ Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Runtime.pm	2010-08-16 18:31:59 UTC (rev 13496)
@@ -7,7 +7,7 @@
 
 # Remember to update this in Catalyst as well!
 
-our $VERSION = '5.80024';
+our $VERSION = '5.80025';
 
 =head1 NAME
 

Modified: Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Script/Server.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Script/Server.pm	2010-08-16 18:30:53 UTC (rev 13495)
+++ Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Script/Server.pm	2010-08-16 18:31:59 UTC (rev 13496)
@@ -236,7 +236,7 @@
                       a restart when modified
                       (defaults to '\.yml$|\.yaml$|\.conf|\.pm$')
    --rdir --restart_directory  the directory to search for
-                      modified files, can be set mulitple times
+                      modified files, can be set multiple times
                       (defaults to '[SCRIPT_DIR]/..')
    --sym  --follow_symlinks   follow symlinks in search directories
                       (defaults to false. this is a no-op on Win32)

Modified: Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Utils.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Utils.pm	2010-08-16 18:30:53 UTC (rev 13495)
+++ Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst/Utils.pm	2010-08-16 18:31:59 UTC (rev 13496)
@@ -1,7 +1,6 @@
 package Catalyst::Utils;
 
 use strict;
-use Catalyst::Exception;
 use File::Spec;
 use HTTP::Request;
 use Path::Class;
@@ -140,6 +139,13 @@
         eval { $tmpdir->mkpath };
 
         if ($@) {
+            # don't load Catalyst::Exception as a BEGIN in Utils,
+            # because Utils often gets loaded before MyApp.pm, and if
+            # Catalyst::Exception is loaded before MyApp.pm, it does
+            # not honor setting
+            # $Catalyst::Exception::CATALYST_EXCEPTION_CLASS in
+            # MyApp.pm
+            require Catalyst::Exception;
             Catalyst::Exception->throw(
                 message => qq/Couldn't create tmpdir '$tmpdir', "$@"/ );
         }

Modified: Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst.pm	2010-08-16 18:30:53 UTC (rev 13495)
+++ Catalyst-Runtime/5.80/branches/psgi/lib/Catalyst.pm	2010-08-16 18:31:59 UTC (rev 13496)
@@ -81,7 +81,7 @@
 
 # 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 @@
 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<MyApp::Model::Foo> receives the following data when
 constructed:
@@ -905,6 +905,21 @@
         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 @@
 
 Constructs an absolute L<URI> 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<Catalyst::Plugin::SmartURI>.
 
 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 @@
 
     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 @@
         %$config
     );
 
-    my @comps = $locator->plugins;
+    # XXX think about ditching this sort entirely
+    my @comps = sort { length $a <=> length $b } $locator->plugins;
 
     return @comps;
 }
@@ -3146,6 +3163,8 @@
 
 Yuval Kogman, C<nothingmuch at woobling.org>
 
+rainboxx: Matthias Dietrich, C<perl at rainboxx.de>
+
 =head1 LICENSE
 
 This library is free software. You can redistribute it and/or modify it under

Modified: Catalyst-Runtime/5.80/branches/psgi/t/custom_exception_class_simple.t
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/t/custom_exception_class_simple.t	2010-08-16 18:30:53 UTC (rev 13495)
+++ Catalyst-Runtime/5.80/branches/psgi/t/custom_exception_class_simple.t	2010-08-16 18:31:59 UTC (rev 13496)
@@ -4,9 +4,17 @@
 use warnings;
 use FindBin qw/$Bin/;
 use lib "$Bin/lib";
-use Test::More tests => 1;
+use Test::More tests => 2;
 use Test::Exception;
 
 lives_ok {
     require TestAppClassExceptionSimpleTest;
 } 'Can load application';
+
+
+lives_ok {
+    Catalyst::Exception->throw
+} 'throw is properly stubbed out';
+
+
+

Added: Catalyst-Runtime/5.80/branches/psgi/t/lib/TestApp/Controller/Moose/NoAttributes.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/t/lib/TestApp/Controller/Moose/NoAttributes.pm	                        (rev 0)
+++ Catalyst-Runtime/5.80/branches/psgi/t/lib/TestApp/Controller/Moose/NoAttributes.pm	2010-08-16 18:31:59 UTC (rev 13496)
@@ -0,0 +1,16 @@
+package TestApp::Controller::Moose::NoAttributes;
+use Moose;
+extends qw/Catalyst::Controller/;
+
+__PACKAGE__->config(
+   actions => {
+       test => { Local => undef }
+   }
+);
+
+sub test {
+}
+
+no Moose;
+1;
+

Modified: Catalyst-Runtime/5.80/branches/psgi/t/lib/TestAppClassExceptionSimpleTest.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/t/lib/TestAppClassExceptionSimpleTest.pm	2010-08-16 18:30:53 UTC (rev 13495)
+++ Catalyst-Runtime/5.80/branches/psgi/t/lib/TestAppClassExceptionSimpleTest.pm	2010-08-16 18:31:59 UTC (rev 13496)
@@ -10,6 +10,8 @@
 use strict;
 use warnings;
 
+use Catalyst::Utils; #< some of the scripts use Catalyst::Utils before MyApp.pm
+
 BEGIN { $Catalyst::Exception::CATALYST_EXCEPTION_CLASS = 'TestAppClassExceptionSimpleTest::Exception'; }
 
 use Catalyst;

Added: Catalyst-Runtime/5.80/branches/psgi/t/unit_core_methodattributes_method_metaclass_on_subclasses.t
===================================================================
--- Catalyst-Runtime/5.80/branches/psgi/t/unit_core_methodattributes_method_metaclass_on_subclasses.t	                        (rev 0)
+++ Catalyst-Runtime/5.80/branches/psgi/t/unit_core_methodattributes_method_metaclass_on_subclasses.t	2010-08-16 18:31:59 UTC (rev 13496)
@@ -0,0 +1,30 @@
+use strict;
+use Test::More;
+
+{
+    package NoAttributes::CT;
+    use Moose;
+    BEGIN { extends qw/Catalyst::Controller/; };
+
+    sub test {}
+}
+{
+    package NoAttributes::RT;
+    use Moose;
+    extends qw/Catalyst::Controller/;
+
+    sub test {}
+}
+
+foreach my $class (qw/ CT RT /) {
+    my $class_name = 'NoAttributes::' . $class;
+    my $meta = $class_name->meta;
+    my $meth = $meta->find_method_by_name('test');
+    {
+        local $TODO = "Known MX::MethodAttributes issue";
+        ok $meth->can('attributes'), 'method metaclass has ->attributes method for ' . $class;;
+    }
+}
+
+done_testing;
+




More information about the Catalyst-commits mailing list