r51784 - in /trunk/libcatalyst-perl: ./ debian/ lib/ lib/Catalyst/ lib/Catalyst/Engine/ t/ t/aggregate/ t/lib/ t/lib/TestApp/Action/ t/lib/TestApp/Controller/Action/ t/lib/TestAppEncoding/Controller/

jawnsy-guest at users.alioth.debian.org jawnsy-guest at users.alioth.debian.org
Sat Jan 30 01:33:40 UTC 2010


Author: jawnsy-guest
Date: Sat Jan 30 01:33:32 2010
New Revision: 51784

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=51784
Log:
* New upstream release
* Add dependency on namespace::clean 0.13
* Change perl-modules to perl, per policy
* Standards-Version 3.8.4 (no changes)

Added:
    trunk/libcatalyst-perl/t/aggregate/catalyst_test_utf8.t
      - copied unchanged from r51775, branches/upstream/libcatalyst-perl/current/t/aggregate/catalyst_test_utf8.t
    trunk/libcatalyst-perl/t/lib/TestApp/Action/TestExtraArgsAction.pm
      - copied unchanged from r51775, branches/upstream/libcatalyst-perl/current/t/lib/TestApp/Action/TestExtraArgsAction.pm
Modified:
    trunk/libcatalyst-perl/Changes
    trunk/libcatalyst-perl/MANIFEST
    trunk/libcatalyst-perl/META.yml
    trunk/libcatalyst-perl/Makefile.PL
    trunk/libcatalyst-perl/TODO
    trunk/libcatalyst-perl/debian/changelog
    trunk/libcatalyst-perl/debian/control
    trunk/libcatalyst-perl/lib/Catalyst.pm
    trunk/libcatalyst-perl/lib/Catalyst/Component.pm
    trunk/libcatalyst-perl/lib/Catalyst/Controller.pm
    trunk/libcatalyst-perl/lib/Catalyst/Engine/CGI.pm
    trunk/libcatalyst-perl/lib/Catalyst/Runtime.pm
    trunk/libcatalyst-perl/t/aggregate/live_component_controller_action_action.t
    trunk/libcatalyst-perl/t/aggregate/live_component_controller_action_chained.t
    trunk/libcatalyst-perl/t/aggregate/unit_core_engine_cgi-prepare_path.t
    trunk/libcatalyst-perl/t/aggregate/unit_core_uri_for.t
    trunk/libcatalyst-perl/t/lib/TestApp.pm
    trunk/libcatalyst-perl/t/lib/TestApp/Controller/Action/Action.pm
    trunk/libcatalyst-perl/t/lib/TestAppEncoding/Controller/Root.pm
    trunk/libcatalyst-perl/t/live_component_controller_context_closure.t

Modified: trunk/libcatalyst-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/Changes?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/Changes (original)
+++ trunk/libcatalyst-perl/Changes Sat Jan 30 01:33:32 2010
@@ -1,14 +1,43 @@
 # This file documents the revision history for Perl extension Catalyst.
+
+5.80019 2010-01-29 01:04:09
+
+  Bug fixed:
+   - Calls to $c->uri_for with private paths as strings (e.g.
+     $c->uri_for('controller/action', 'arg1', 'arg2') ) no longer have
+     / encoded to %2F. This is due to $c->uri_for('static', 'css/foo', $bar)
+     which should not be encoded.
+     Calls with an action object (rather than a string), or uri_for action
+     will still encode / in args and captures to %2F
+
+   - The above noted / => %2F encoding in uri_for_action or uri_for with
+     an action object has been fixed to not just encode the first slash in
+     any set of args/captures.
+
+   - nginx and lighttpd FCGI requests with URI encoded sections as the first
+     path part have been fixed to operate correctly.
+
+   - A source of bogus warnings in Catalyst::Component::BUILDARGS has been
+     removed.
+
+  Documentation:
+   - Improve the documentation about -Home and how Catalyst finds the home path
+     for applications.
+   - Various minor typo fixes.
+
+  New features:
+   - Allow passing additional arguments to action constructors.
 
 5.80018 2010-01-12 22:24:20
 
   Bug fixed:
    - Call ->canonical on URI derived from $ENV{REQUEST_URI} to get
      paths correctly decoded. This bug was previously hidden by a bug
-     in HTTP::Request::AsCGI
+     in HTTP::Request::AsCGI.
 
   Documentation:
    - Clarify that uri_for_action works on private paths, with example.
+   - Clarify documentation about debug
 
   Deprecations:
    - Saying use Catalyst::Test; (without an application name or () to stop
@@ -436,7 +465,7 @@
           B::Hooks::OP::Check::StashChange
         - Fix the unattached chain debug table for endpoints with no
           parents at all.
-        - Turn of test aggregation by default. Only aggregate if the
+        - Turn off test aggregation by default. Only aggregate if the
           AGGREGATE_TESTS environment variable is set and a recent
           Test::Aggregate is available.
         - Bump to MooseX::MethodAttributes 0.09, to gain the

Modified: trunk/libcatalyst-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/MANIFEST?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/MANIFEST (original)
+++ trunk/libcatalyst-perl/MANIFEST Sat Jan 30 01:33:32 2010
@@ -69,6 +69,7 @@
 t/aggregate/c3_appclass_bug.t
 t/aggregate/c3_mro.t
 t/aggregate/caf_backcompat.t
+t/aggregate/catalyst_test_utf8.t
 t/aggregate/custom_live_component_controller_action_auto_doublebug.t
 t/aggregate/custom_live_path_bug.t
 t/aggregate/deprecated_test_import.t
@@ -204,6 +205,7 @@
 t/lib/ScriptTestApp/Script/Foo.pm
 t/lib/TestApp.pm
 t/lib/TestApp/Action/TestBefore.pm
+t/lib/TestApp/Action/TestExtraArgsAction.pm
 t/lib/TestApp/Action/TestMyAction.pm
 t/lib/TestApp/Controller/Action.pm
 t/lib/TestApp/Controller/Action/Action.pm

Modified: trunk/libcatalyst-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/META.yml?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/META.yml (original)
+++ trunk/libcatalyst-perl/META.yml Sat Jan 30 01:33:32 2010
@@ -56,7 +56,7 @@
   Tree::Simple::Visitor::FindByPath: 0
   URI: 1.35
   namespace::autoclean: 0.09
-  namespace::clean: 0
+  namespace::clean: 0.13
   perl: 5.8.4
 resources:
   IRC: irc://irc.perl.org/#catalyst
@@ -64,4 +64,4 @@
   homepage: http://dev.catalyst.perl.org/
   license: http://dev.perl.org/licenses/
   repository: http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Runtime/
-version: 5.80018
+version: 5.80019

Modified: trunk/libcatalyst-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/Makefile.PL?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/Makefile.PL (original)
+++ trunk/libcatalyst-perl/Makefile.PL Sat Jan 30 01:33:32 2010
@@ -17,7 +17,7 @@
 
 requires 'List::MoreUtils';
 requires 'namespace::autoclean' => '0.09';
-requires 'namespace::clean';
+requires 'namespace::clean' => '0.13';
 requires 'B::Hooks::EndOfScope' => '0.08';
 requires 'MooseX::Emulate::Class::Accessor::Fast' => '0.00903';
 requires 'Class::MOP' => '0.95';

Modified: trunk/libcatalyst-perl/TODO
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/TODO?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/TODO (original)
+++ trunk/libcatalyst-perl/TODO Sat Jan 30 01:33:32 2010
@@ -4,12 +4,6 @@
      twice when called via ->go or ->visit.
 
      Test app: http://github.com/bobtfish/catalyst-app-bug-go_chain/tree/master
-
-   - Bricas' Exception blog post
-
-     http://bricas.vox.com/library/post/catalyst-exceptionclass.html
-
-     Broken by recent exception refactoring
 
 # Compatibility warnings to add:
 

Modified: trunk/libcatalyst-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/debian/changelog?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/debian/changelog (original)
+++ trunk/libcatalyst-perl/debian/changelog Sat Jan 30 01:33:32 2010
@@ -1,10 +1,16 @@
-libcatalyst-perl (5.80018-2) UNRELEASED; urgency=low
-
-  * NOT RELEASED YET
+libcatalyst-perl (5.80019-1) UNRELEASED; urgency=low
+
+  [ Jonathan Yu ]
+  * New upstream release
+  * Add dependency on namespace::clean 0.13
+  * Change perl-modules to perl, per policy
+  * Standards-Version 3.8.4 (no changes)
+
+  [ Krzysztof Krzyżaniak (eloy) ]
   * Add perl-modules (>= 5.10.0) as alternative to libmodule-pluggable-perl in
     dependencies
 
- -- Krzysztof Krzyżaniak (eloy) <eloy at debian.org>  Mon, 18 Jan 2010 18:21:23 +0100
+ -- Jonathan Yu <jawnsy at cpan.org>  Fri, 29 Jan 2010 20:44:18 -0500
 
 libcatalyst-perl (5.80018-1) unstable; urgency=low
 

Modified: trunk/libcatalyst-perl/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/debian/control?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/debian/control (original)
+++ trunk/libcatalyst-perl/debian/control Sat Jan 30 01:33:32 2010
@@ -11,17 +11,18 @@
  libhttp-body-perl, libfile-modified-perl, libhttp-request-ascgi-perl (>= 0.8),
  libmime-types-perl, libfile-copy-recursive-perl, libtest-nowarnings-perl,
  libfcgi-procmanager-perl, libcgi-simple-perl, 
- perl-modules (>= 5.10.0) | libmodule-pluggable-perl (>= 3.9),
+ perl (>= 5.10) | libmodule-pluggable-perl (>= 3.9),
  libclass-c3-perl, libparent-perl, libmoose-perl (>= 0.90),
  libclass-c3-adopt-next-perl, libscope-upper-perl, libtask-weaken-perl,
  libmoosex-emulate-class-accessor-fast-perl (>= 0.00903),
  libmoosex-methodattributes-perl (>= 0.17), libnamespace-autoclean-perl (>= 0.09),
  libstring-rewriteprefix-perl, libmoosex-role-withoverloading-perl,
- libmoosex-types-common-perl, libmoosex-getopt-perl
+ libmoosex-types-common-perl, libmoosex-getopt-perl,
+ libnamespace-clean-perl (>= 0.13)
 Maintainer: Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>
 Uploaders: Krzysztof Krzyżaniak (eloy) <eloy at debian.org>,
  gregor herrmann <gregoa at debian.org>, Jonathan Yu <jawnsy at cpan.org>
-Standards-Version: 3.8.3
+Standards-Version: 3.8.4
 Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libcatalyst-perl/
 Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libcatalyst-perl/
 Homepage: http://search.cpan.org/dist/Catalyst-Runtime/
@@ -42,7 +43,8 @@
  libmoosex-emulate-class-accessor-fast-perl (>= 0.00903),
  libmoosex-methodattributes-perl (>= 0.17), libnamespace-autoclean-perl (>= 0.09),
  libstring-rewriteprefix-perl, libtask-weaken-perl, libmoosex-getopt-perl, 
- libmoosex-role-withoverloading-perl, libmoosex-types-common-perl
+ libmoosex-role-withoverloading-perl, libmoosex-types-common-perl,
+ libnamespace-clean-perl (>= 0.13)
 Recommends: libfcgi-perl
 Suggests: libtest-pod-perl, libtest-pod-coverage-perl, 
  libfcgi-procmanager-perl, libcatalyst-engine-apache-perl

Modified: trunk/libcatalyst-perl/lib/Catalyst.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/lib/Catalyst.pm?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/lib/Catalyst.pm (original)
+++ trunk/libcatalyst-perl/lib/Catalyst.pm Sat Jan 30 01:33:32 2010
@@ -78,7 +78,7 @@
 
 # Remember to update this in Catalyst::Runtime as well!
 
-our $VERSION = '5.80018';
+our $VERSION = '5.80019';
 $VERSION = eval $VERSION;
 
 sub import {
@@ -243,6 +243,9 @@
 settings override the application, with <MYAPP>_DEBUG having the highest
 priority.
 
+This sets the log level to 'debug' and enables full debug output on the
+error screen. If you only want the latter, see L<< $c->debug >>.
+
 =head2 -Engine
 
 Forces Catalyst to use a specific engine. Omit the
@@ -262,6 +265,14 @@
 the name will be replaced with underscores, e.g. MyApp::Web should use
 MYAPP_WEB_HOME. If both variables are set, the MYAPP_HOME one will be used.
 
+If none of these are set, Catalyst will attempt to automatically detect the
+home directory. If you are working in a development envirnoment, Catalyst
+will try and find the directory containing either Makefile.PL, Build.PL or
+dist.ini. If the application has been installed into the system (i.e.
+you have done C<make install>), then Catalyst will use the path to your
+application module, without the .pm extension (ie, /foo/MyApp if your
+application was installed at /foo/MyApp.pm)
+
 =head2 -Log
 
     use Catalyst '-Log=warn,fatal,error';
@@ -331,7 +342,7 @@
 need to do something like:
 
     $c->forward('foo');
-    die $c->error if $c->error;
+    die join "\n", @{ $c->error } if @{ $c->error };
 
 Or make sure to always return true values from your actions and write
 your code like this:
@@ -923,6 +934,8 @@
 
 =back
 
+The first three also set the log level to 'debug'.
+
 Calling C<< $c->debug(1) >> has no effect.
 
 =cut
@@ -1246,8 +1259,19 @@
         $path .= '/';
     }
 
+    undef($path) if (defined $path && $path eq '');
+
+    my $params =
+      ( scalar @args && ref $args[$#args] eq 'HASH' ? pop @args : {} );
+
+    carp "uri_for called with undef argument" if grep { ! defined $_ } @args;
+    s/([^$URI::uric])/$URI::Escape::escapes{$1}/go for @args;
+    if (blessed $path) { # Action object only.
+        s|/|%2F|g for @args;
+    }
+
     if ( blessed($path) ) { # action object
-        my $captures = [ map { s|/|%2F|; $_; }
+        my $captures = [ map { s|/|%2F|g; $_; }
                         ( scalar @args && ref $args[0] eq 'ARRAY'
                          ? @{ shift(@args) }
                          : ()) ];
@@ -1260,15 +1284,6 @@
         }
         $path = '/' if $path eq '';
     }
-
-    undef($path) if (defined $path && $path eq '');
-
-    my $params =
-      ( scalar @args && ref $args[$#args] eq 'HASH' ? pop @args : {} );
-
-    carp "uri_for called with undef argument" if grep { ! defined $_ } @args;
-    s/([^$URI::uric])/$URI::Escape::escapes{$1}/go for @args;
-    s|/|%2F| for @args;
 
     unshift(@args, $path);
 

Modified: trunk/libcatalyst-perl/lib/Catalyst/Component.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/lib/Catalyst/Component.pm?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/lib/Catalyst/Component.pm (original)
+++ trunk/libcatalyst-perl/lib/Catalyst/Component.pm Sat Jan 30 01:33:32 2010
@@ -83,8 +83,6 @@
             $args = $_[1] if ref($_[1]) eq 'HASH';
         } elsif (Class::MOP::is_class_loaded($_[0]) &&
                 $_[0]->isa('Catalyst') && ref($_[1]) eq 'HASH') {
-            $args = $_[1];
-        } elsif ($_[0] == $_[1]) {
             $args = $_[1];
         } else {
             $args = +{ @_ };
@@ -157,7 +155,7 @@
 
 =head1 METHODS
 
-=head2 new($c, $arguments)
+=head2 new($app, $arguments)
 
 Called by COMPONENT to instantiate the component; should return an object
 to be stored in the application's component hash.
@@ -168,9 +166,10 @@
 
 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 $c and any config entry on the application for this component (for example,
+as $app and any config entry on the application for this component (for example,
 in the case of MyApp::Controller::Foo this would be
 C<< MyApp->config('Controller::Foo' => \%conf >>).
+
 The arguments are expected to be a hashref and are merged with the
 C<< __PACKAGE__->config >> hashref before calling C<< ->new >>
 to instantiate the component.

Modified: trunk/libcatalyst-perl/lib/Catalyst/Controller.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/lib/Catalyst/Controller.pm?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/lib/Catalyst/Controller.pm (original)
+++ trunk/libcatalyst-perl/lib/Catalyst/Controller.pm Sat Jan 30 01:33:32 2010
@@ -255,9 +255,15 @@
     my $class = (exists $args{attributes}{ActionClass}
                     ? $args{attributes}{ActionClass}[0]
                     : $self->_action_class);
-
     Class::MOP::load_class($class);
-    return $class->new( \%args );
+
+    my $action_args = $self->config->{action_args};
+    my %extra_args = (
+        %{ $action_args->{'*'}           || {} },
+        %{ $action_args->{ $args{name} } || {} },
+    );
+
+    return $class->new({ %extra_args, %args });
 }
 
 sub _parse_attrs {
@@ -440,6 +446,26 @@
 
 Sets 'path_prefix', as described below.
 
+=head2 action_args
+
+Allows you to set constructor arguments on your actions. You can set arguments
+globally (for all actions of the controller) and specifically (for a single
+action). This is particularly useful when using C<ActionRole>s
+(L<Catalyst::Controller::ActionRole>) and custom C<ActionClass>es.
+
+    __PACKAGE__->config(
+        action_args => {
+            '*' => { globalarg1 => 'hello', globalarg2 => 'goodbye' },
+            'specific_action' => { customarg => 'arg1' },
+        },
+     );
+
+In the case above the action class associated with C<specific_action> would get
+passed the following arguments, in addition to the normal action constructor
+arguments, when it is instantiated:
+
+  (globalarg1 => 'hello', globalarg2 => 'goodbye', customarg => 'arg1')
+
 =head1 METHODS
 
 =head2 BUILDARGS ($app, @args)

Modified: trunk/libcatalyst-perl/lib/Catalyst/Engine/CGI.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/lib/Catalyst/Engine/CGI.pm?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/lib/Catalyst/Engine/CGI.pm (original)
+++ trunk/libcatalyst-perl/lib/Catalyst/Engine/CGI.pm Sat Jan 30 01:33:32 2010
@@ -168,7 +168,8 @@
             if (substr($req_uri, 0, 1) ne '/') {
                 my ($match) = $req_uri =~ m|^([^/]+)|;
                 my ($path_info_part) = $path_info =~ m|^(.*?\Q$match\E)|;
-                substr($req_uri, 0, length($match), $path_info_part);
+                substr($req_uri, 0, length($match), $path_info_part)
+                    if $path_info_part;
             }
             $path_info = $req_uri;
         }

Modified: trunk/libcatalyst-perl/lib/Catalyst/Runtime.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/lib/Catalyst/Runtime.pm?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/lib/Catalyst/Runtime.pm (original)
+++ trunk/libcatalyst-perl/lib/Catalyst/Runtime.pm Sat Jan 30 01:33:32 2010
@@ -7,7 +7,7 @@
 
 # Remember to update this in Catalyst as well!
 
-our $VERSION='5.80018';
+our $VERSION='5.80019';
 
 $VERSION = eval $VERSION;
 

Modified: trunk/libcatalyst-perl/t/aggregate/live_component_controller_action_action.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/t/aggregate/live_component_controller_action_action.t?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/t/aggregate/live_component_controller_action_action.t (original)
+++ trunk/libcatalyst-perl/t/aggregate/live_component_controller_action_action.t Sat Jan 30 01:33:32 2010
@@ -10,7 +10,7 @@
 
 BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
 
-use Test::More tests => 42 * $iters;
+use Test::More;
 use Catalyst::Test 'TestApp';
 
 if ( $ENV{CAT_BENCHMARK} ) {
@@ -147,4 +147,25 @@
         );
     }
 
+    {
+        ok( my $response = request('http://localhost/action_action_seven'),
+            'Request' );
+        ok( $response->is_success, 'Response Successful 2xx' );
+        is( $response->content_type, 'text/plain', 'Response Content-Type' );
+        is( $response->header('X-Catalyst-Action'),
+            'action_action_seven', 'Test Action' );
+        is(
+            $response->header('X-Test-Class'),
+            'TestApp::Controller::Action::Action',
+            'Test Class'
+        );
+        is( $response->header('X-TestExtraArgsAction'), '42,23', 'Extra args get passed to action contstructor' );
+        like(
+            $response->content,
+            qr/^bless\( .* 'Catalyst::Request' \)$/s,
+            'Content is a serialized Catalyst::Request'
+        );
+    }
 }
+
+done_testing;

Modified: trunk/libcatalyst-perl/t/aggregate/live_component_controller_action_chained.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/t/aggregate/live_component_controller_action_chained.t?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/t/aggregate/live_component_controller_action_chained.t (original)
+++ trunk/libcatalyst-perl/t/aggregate/live_component_controller_action_chained.t Sat Jan 30 01:33:32 2010
@@ -1085,7 +1085,8 @@
             'request ' . $path . ' ok');
         # Just check that the path matches, as who the hell knows or cares
         # where the app is based (live tests etc)
-        ok( index($content, $path) > 1, 'uri can round trip through uri_for' );
+        ok( index($content, $path) > 1, 'uri can round trip through uri_for' )
+            or diag("Expected $path, got $content");
     }
 }
 

Modified: trunk/libcatalyst-perl/t/aggregate/unit_core_engine_cgi-prepare_path.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/t/aggregate/unit_core_engine_cgi-prepare_path.t?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/t/aggregate/unit_core_engine_cgi-prepare_path.t (original)
+++ trunk/libcatalyst-perl/t/aggregate/unit_core_engine_cgi-prepare_path.t Sat Jan 30 01:33:32 2010
@@ -62,6 +62,31 @@
     is ''.$r->base, 'http://www.foo.com/';
 }
 
+# nginx example from espent with path /"foo"
+{
+    my $r = get_req (
+        PATH_INFO => '"foo"',
+        SCRIPT_NAME => '/',
+        REQUEST_URI => '/%22foo%22',
+    );
+    is ''.$r->path, '%22foo%22';
+    is ''.$r->uri, 'http://www.foo.com/%22foo%22';
+    is ''.$r->base, 'http://www.foo.com/';
+}
+
+# nginx example from espent with path /"foo" and the app based at /oslobilder
+{
+    my $r = get_req (
+        PATH_INFO => 'oslobilder/"foo"',
+        SCRIPT_NAME => '/oslobilder/',
+        REQUEST_URI => '/oslobilder/%22foo%22',
+    );
+    is ''.$r->path, '%22foo%22';
+    is ''.$r->uri, 'http://www.foo.com/oslobilder/%22foo%22';
+    is ''.$r->base, 'http://www.foo.com/oslobilder/';
+}
+
+
 
 
 # FIXME - Test proxy logic

Modified: trunk/libcatalyst-perl/t/aggregate/unit_core_uri_for.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/t/aggregate/unit_core_uri_for.t?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/t/aggregate/unit_core_uri_for.t (original)
+++ trunk/libcatalyst-perl/t/aggregate/unit_core_uri_for.t Sat Jan 30 01:33:32 2010
@@ -1,16 +1,17 @@
 use strict;
 use warnings;
-
-use Test::More tests => 20;
+use FindBin qw/$Bin/;
+use lib "$FindBin::Bin/../lib";
+use Test::More;
 use URI;
 
-use_ok('Catalyst');
+use_ok('TestApp');
 
 my $request = Catalyst::Request->new( {
                 base => URI->new('http://127.0.0.1/foo')
               } );
-
-my $context = Catalyst->new( {
+my $dispatcher = TestApp->dispatcher;
+my $context = TestApp->new( {
                 request => $request,
                 namespace => 'yada',
               } );
@@ -143,3 +144,21 @@
     is_deeply($query_params_base, $query_params_test,
               "uri_for() doesn't mess up query parameter hash in the caller");
 }
+
+
+{
+    my $path_action = $dispatcher->get_action_by_path(
+                       '/action/path/six'
+                     );
+
+    # 5.80018 is only encoding the first of the / in the arg.
+    is(
+        Catalyst::uri_for( $context, $path_action, 'foo/bar/baz' )->as_string,
+        'http://127.0.0.1/action/path/six/foo%2Fbar%2Fbaz',
+        'Escape all forward slashes in args as %2F'
+    );
+}
+
+
+done_testing;
+

Modified: trunk/libcatalyst-perl/t/lib/TestApp.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/t/lib/TestApp.pm?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/t/lib/TestApp.pm (original)
+++ trunk/libcatalyst-perl/t/lib/TestApp.pm Sat Jan 30 01:33:32 2010
@@ -20,7 +20,7 @@
 
 TestApp->config( name => 'TestApp', root => '/some/dir' );
 
-if (eval { Class::MOP::load_class('CatalystX::LeakChecker'); 1 }) {
+if ($::setup_leakchecker && eval { Class::MOP::load_class('CatalystX::LeakChecker'); 1 }) {
     with 'CatalystX::LeakChecker';
 
     has leaks => (

Modified: trunk/libcatalyst-perl/t/lib/TestApp/Controller/Action/Action.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/t/lib/TestApp/Controller/Action/Action.pm?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/t/lib/TestApp/Controller/Action/Action.pm (original)
+++ trunk/libcatalyst-perl/t/lib/TestApp/Controller/Action/Action.pm Sat Jan 30 01:33:32 2010
@@ -3,7 +3,15 @@
 use strict;
 use base 'TestApp::Controller::Action';
 
-__PACKAGE__->config( actions => { action_action_five => { ActionClass => '+Catalyst::Action::TestBefore' } } );
+__PACKAGE__->config(
+    actions => {
+        action_action_five => { ActionClass => '+Catalyst::Action::TestBefore' },
+    },
+    action_args => {
+        '*'                 => { extra_arg         => 42 },
+        action_action_seven => { another_extra_arg => 23 },
+    },
+);
 
 sub action_action_one : Global : ActionClass('TestBefore') {
     my ( $self, $c ) = @_;
@@ -38,4 +46,9 @@
     $c->forward('TestApp::View::Dump::Request');
 }
 
+sub action_action_seven : Global : ActionClass('~TestExtraArgsAction') {
+    my ( $self, $c ) = @_;
+    $c->forward('TestApp::View::Dump::Request');
+}
+
 1;

Modified: trunk/libcatalyst-perl/t/lib/TestAppEncoding/Controller/Root.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/t/lib/TestAppEncoding/Controller/Root.pm?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/t/lib/TestAppEncoding/Controller/Root.pm (original)
+++ trunk/libcatalyst-perl/t/lib/TestAppEncoding/Controller/Root.pm Sat Jan 30 01:33:32 2010
@@ -8,7 +8,11 @@
 
 sub binary : Local {
     my ($self, $c) = @_;
-    $c->res->body(do { open(my $fh, '<', $c->path_to('..', '..', 'catalyst_130pix.gif')) or die $!; binmode($fh); local $/ = undef; <$fh>; });
+    $c->res->body(do { 
+        open(my $fh, '<', $c->path_to('..', '..', 'catalyst_130pix.gif')) or die $!; 
+        binmode($fh); 
+        local $/ = undef; <$fh>;
+    });
 }
 
 sub binary_utf8 : Local {
@@ -20,6 +24,23 @@
     $c->res->body($str);
 }
 
+# called by t/aggregate/catalyst_test_utf8.t
+sub utf8_non_ascii_content : Local {
+    use utf8;
+    my ($self, $c) = @_;
+    
+    my $str = 'ʇsʎlɐʇɐɔ';  # 'catalyst' flipped at http://www.revfad.com/flip.html
+    ok utf8::is_utf8($str), '$str is in UTF8 internally';
+    
+    # encode $str into a sequence of octets and turn off the UTF-8 flag, so that
+    # we don't get the 'Wide character in syswrite' error in Catalyst::Engine
+    utf8::encode($str);
+    ok !utf8::is_utf8($str), '$str is a sequence of octets (byte string)';
+    
+    $c->res->body($str);
+}
+
+
 sub end : Private {
     my ($self,$c) = @_;
 }

Modified: trunk/libcatalyst-perl/t/live_component_controller_context_closure.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcatalyst-perl/t/live_component_controller_context_closure.t?rev=51784&op=diff
==============================================================================
--- trunk/libcatalyst-perl/t/live_component_controller_context_closure.t (original)
+++ trunk/libcatalyst-perl/t/live_component_controller_context_closure.t Sat Jan 30 01:33:32 2010
@@ -13,6 +13,8 @@
 use FindBin;
 use lib "$FindBin::Bin/lib";
 
+BEGIN { $::setup_leakchecker = 1 }
+
 use Catalyst::Test 'TestApp';
 
 {




More information about the Pkg-perl-cvs-commits mailing list