[Catalyst-commits] r8579 - in
Catalyst-Runtime/5.70/branches/proxystuff: . lib lib/Catalyst
lib/Catalyst/DispatchType lib/Catalyst/Engine
lib/Catalyst/Engine/HTTP lib/Catalyst/Engine/HTTP/Restarter
lib/Catalyst/Request script t t/lib t/lib/TestApp/Controller
t/lib/TestApp/Controller/Action
t/lib/TestApp/Controller/Action/Chained
t/lib/TestApp/Controller/Action/Chained/ParentChain
t/lib/TestApp/Controller/Engine/Request
t/lib/TestApp/Controller/Engine/Response
jshirley at dev.catalyst.perl.org
jshirley at dev.catalyst.perl.org
Mon Nov 3 23:20:58 GMT 2008
Author: jshirley
Date: 2008-11-03 23:20:57 +0000 (Mon, 03 Nov 2008)
New Revision: 8579
Added:
Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained/ParentChain/
Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained/ParentChain/Relative.pm
Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained/PathPrefix.pm
Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Go.pm
Removed:
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Build.pm
Modified:
Catalyst-Runtime/5.70/branches/proxystuff/
Catalyst-Runtime/5.70/branches/proxystuff/Changes
Catalyst-Runtime/5.70/branches/proxystuff/Makefile.PL
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Action.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/ActionChain.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/ActionContainer.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/AttrContainer.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Base.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Component.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Controller.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Chained.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Default.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Index.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Path.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Regex.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Dispatcher.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/CGI.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/FastCGI.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/HTTP.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/HTTP/Restarter.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Exception.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Log.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Manual.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Model.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Request.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Request/Upload.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Response.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Runtime.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Stats.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Test.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Utils.pm
Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/View.pm
Catalyst-Runtime/5.70/branches/proxystuff/script/catalyst.pl
Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp.pm
Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained.pm
Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained/ParentChain.pm
Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/ForwardTo.pm
Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/TestRelative.pm
Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Args.pm
Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Engine/Request/URI.pm
Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Engine/Response/Cookies.pm
Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Root.pm
Catalyst-Runtime/5.70/branches/proxystuff/t/live_component_controller_action_chained.t
Catalyst-Runtime/5.70/branches/proxystuff/t/live_component_controller_action_forward.t
Catalyst-Runtime/5.70/branches/proxystuff/t/live_component_controller_action_regexp.t
Catalyst-Runtime/5.70/branches/proxystuff/t/live_engine_request_parameters.t
Catalyst-Runtime/5.70/branches/proxystuff/t/live_engine_request_uploads.t
Catalyst-Runtime/5.70/branches/proxystuff/t/live_engine_request_uri.t
Catalyst-Runtime/5.70/branches/proxystuff/t/live_engine_response_cookies.t
Catalyst-Runtime/5.70/branches/proxystuff/t/live_priorities.t
Catalyst-Runtime/5.70/branches/proxystuff/t/optional_http-server-restart.t
Catalyst-Runtime/5.70/branches/proxystuff/t/optional_http-server.t
Catalyst-Runtime/5.70/branches/proxystuff/t/unit_core_component.t
Catalyst-Runtime/5.70/branches/proxystuff/t/unit_core_mvc.t
Catalyst-Runtime/5.70/branches/proxystuff/t/unit_utils_subdir.t
Log:
r14608 at tengu (orig r7809): bricas | 2008-05-26 17:40:53 -0700
Get some of the optional_* tests working from dirs with spaces (RT #26455)
r14609 at tengu (orig r7810): bricas | 2008-05-26 18:43:13 -0700
fix up test to match release.
r14610 at tengu (orig r7811): bricas | 2008-05-26 19:42:11 -0700
Fix Catalyst::Utils::home() when application .pm is in the current dir (RT #34437)
r14612 at tengu (orig r7857): bricas | 2008-05-29 06:01:03 -0700
Added the ability to remove parameters in req->uri_with() by passing in an undef value (RT #34782)
r14619 at tengu (orig r7936): bricas | 2008-06-20 11:14:11 -0700
remove a confusing and duplicate bit of documentation
r14620 at tengu (orig r7938): bricas | 2008-06-23 06:38:24 -0700
Fix for LocalRegex when used in the Root controller
r14621 at tengu (orig r7995): bricas | 2008-06-23 15:01:06 -0700
Update HTTP::Body dep so that the uploadtmp config value will work (RT #22540)
r14622 at tengu (orig r7996): bricas | 2008-06-23 17:14:21 -0700
remove 0-length query string components so warnings aren't thrown (RT #36428)
r14624 at tengu (orig r8000): marcus | 2008-06-25 12:08:09 -0700
merge compres branch
r14626 at tengu (orig r8002): marcus | 2008-06-25 13:16:15 -0700
merge go branch.
r14627 at tengu (orig r8003): marcus | 2008-06-25 13:38:36 -0700
Prepare for 5.7099_01
r14628 at tengu (orig r8006): marcus | 2008-06-25 23:48:13 -0700
Add go to changes
r14629 at tengu (orig r8011): marcus | 2008-06-27 02:19:04 -0700
Fix warning for dev versions
r14630 at tengu (orig r8012): bricas | 2008-06-27 05:06:54 -0700
rescue :PathPrefix from an old branch
r14631 at tengu (orig r8053): bricas | 2008-06-30 05:19:10 -0700
nuked Catalyst::Build
r14632 at tengu (orig r8054): bricas | 2008-06-30 07:58:05 -0700
authors cleanup
r14633 at tengu (orig r8057): bricas | 2008-06-30 09:25:16 -0700
missed one
r14634 at tengu (orig r8106): t0m | 2008-07-12 05:02:32 -0700
Clarify inner package behavior of companent instantation in the POD. (no 1 of 2 doc patches I promised mst)
r14635 at tengu (orig r8114): bricas | 2008-07-14 11:20:11 -0700
Updated Catalyst::Test docs to mention the use of HTTP::Request objects (Rafael Kitover)
r14636 at tengu (orig r8124): marcus | 2008-07-16 10:13:20 -0700
Prepare 5.7100
r14637 at tengu (orig r8125): bricas | 2008-07-16 10:23:53 -0700
removing some Dumpers
r14638 at tengu (orig r8126): marcus | 2008-07-16 10:32:35 -0700
prepare for devel release
r14639 at tengu (orig r8128): bricas | 2008-07-16 17:37:48 -0700
doc typo fix (rafl)
r14640 at tengu (orig r8134): bricas | 2008-07-17 08:33:07 -0700
tiny doc update
r14641 at tengu (orig r8135): bricas | 2008-07-17 17:01:14 -0700
Fix regression for regexp fallback in model(), view() and controller()
r14642 at tengu (orig r8136): bricas | 2008-07-17 18:21:07 -0700
more fixes to regexp fallback, ugh.
r14643 at tengu (orig r8138): bricas | 2008-07-18 04:23:28 -0700
Added the supplied argument to the regexp fallback warning for easier debugging
r14644 at tengu (orig r8140): bricas | 2008-07-18 05:29:44 -0700
Ensure ACCEPT_CONTEXT is called for results from component()
r14645 at tengu (orig r8141): bricas | 2008-07-18 06:20:02 -0700
add a test for ACCEPT_CONTEXT from regex fallback in view()
r14646 at tengu (orig r8143): marcus | 2008-07-20 01:11:37 -0700
Prepare for _03 dev release
r14647 at tengu (orig r8149): dandv | 2008-07-22 14:26:55 -0700
Added warnign that path_to() should be called after MyApp->setup, which sets $c->config->{home}
r14648 at tengu (orig r8151): dandv | 2008-07-23 03:56:29 -0700
Undoing my commit since the issue had been fixed in Catalyst::Devel 1.08 (#37869)
r14873 at tengu (orig r8161): marcus | 2008-07-24 23:56:31 -0700
Add chained go tests
r14874 at tengu (orig r8175): ash | 2008-08-01 09:58:25 -0700
TODO tests added for :ChainedParent and :Chained('../action') atrs
r14875 at tengu (orig r8185): castaway | 2008-08-05 13:21:25 -0700
Switch syntax example for model to use create=static
r14876 at tengu (orig r8194): marcus | 2008-08-06 13:19:47 -0700
Add pt translation of error msg
r14877 at tengu (orig r8195): bricas | 2008-08-07 04:51:10 -0700
tidy up the name of module in pod
r14878 at tengu (orig r8196): bricas | 2008-08-07 09:31:31 -0700
Fix some Win32 test failures
r14879 at tengu (orig r8197): bricas | 2008-08-08 07:08:12 -0700
go() cannot dispatch to anon. actions, fix code and tests to match.
r14880 at tengu (orig r8199): bricas | 2008-08-08 12:35:45 -0700
pod fix
r14881 at tengu (orig r8231): matthewt | 2008-08-18 05:02:54 -0700
merge rafl's test
r14882 at tengu (orig r8232): gbjk | 2008-08-18 12:03:08 -0700
DispatchType/Chained:
A chain of equal actions but less captures should win over one with more captures.
Less captures is taken to mean it did so less ambiguously, and therefore wins the fight.
A chain of more actions will lose to one of less actions even if it had less captures, though.
i.e.: Actions beat Captures, but Captures decide betwixt Actions.
r14883 at tengu (orig r8235): zarquon | 2008-08-20 11:25:20 -0700
r13745 at harold: kd | 2008-08-20 19:24:42 +0100
improvements to redirect doc
r14884 at tengu (orig r8271): rafl | 2008-08-24 12:31:44 -0700
Move :Chained sugar out of DispatchType::Chained.
r14885 at tengu (orig r8272): rafl | 2008-08-24 12:31:53 -0700
Fix tests for ../action chaining.
rootdef is an endaction; the tests expect two args for chained_rel.
r14886 at tengu (orig r8273): rafl | 2008-08-24 12:32:00 -0700
Implement :Chained('../action').
r14887 at tengu (orig r8274): rafl | 2008-08-24 12:32:08 -0700
Implement :ChainedParent.
r14888 at tengu (orig r8275): rafl | 2008-08-24 12:32:14 -0700
UnTODO :Chained('../action') tests.
r14889 at tengu (orig r8276): rafl | 2008-08-24 12:32:21 -0700
Test :Chained('../../action').
r14890 at tengu (orig r8277): rafl | 2008-08-24 12:32:27 -0700
Implement relative chaining over more than one level.
r14891 at tengu (orig r8278): rafl | 2008-08-24 12:32:34 -0700
UnTODO tests for relative chaining over multiple levels.
r14892 at tengu (orig r8282): rafl | 2008-08-25 10:28:56 -0700
Add a test controller for :Chained('../../action').
Forgot to add it in r8276.
r14893 at tengu (orig r8295): rafl | 2008-08-26 08:20:04 -0700
Changelogging.
r14997 at tengu (orig r8326): rafl | 2008-09-02 04:48:19 -0700
Mention PathPrefix in Chained docs.
r14998 at tengu (orig r8327): rafl | 2008-09-02 04:48:31 -0700
Document :Chained('../action').
r14999 at tengu (orig r8328): rafl | 2008-09-02 04:48:44 -0700
Document :ChainedParent.
r16703 at tengu (orig r8494): castaway | 2008-10-01 12:25:32 -0700
Improve docs for uri_for
r16803 at tengu (orig r8531): matthewt | 2008-10-15 12:17:30 -0700
back out go() so we can ship a 5.7100 with other features and bugfixes
r16804 at tengu (orig r8533): andyg | 2008-10-15 12:23:04 -0700
Workaround change in LWP that broke a cookie test (RT #40037)
Property changes on: Catalyst-Runtime/5.70/branches/proxystuff
___________________________________________________________________
Name: svk:merge
- 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
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-Runtime:6165
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:/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
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.70/branches/proxystuff/Changes
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/Changes 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/Changes 2008-11-03 23:20:57 UTC (rev 8579)
@@ -1,11 +1,49 @@
# This file documents the revision history for Perl extension Catalyst.
+5.7XXXXXX XXXX
+ - Workaround change in LWP that broke a cookie test (RT #40037)
+ - Back out go() since that feature's been pushed to 5.80
+ - Fix some Win32 test failures
+ - Add pt translation of error message (wreis)
+ - Make :Chained('../action') work (Florian Ragwitz)
+
+5.7099_03 2008-07-20 10:10:00
+ - Fix regressions for regexp fallback in model(), view() and controller()
+ - Added the supplied argument to the regexp fallback warning for easier
+ debugging
+ - Ensure ACCEPT_CONTEXT is called for results from component()
+
+5.7099_02 2008-07-16 19:10:00
+ - Added PathPrefix attribute
+ - Removed Catalyst::Build; we've long since moved to Module::Install
+ - Updated Catalyst::Test docs to mention the use of HTTP::Request
+ objects (Rafael Kitover)
+
+5.7099_01 2008-06-25 22:36:00
+ - Refactored component resolution (component(), models(), model(), et al). We now
+ throw warnings for two reasons:
+ 1) model() or view() was called with no arguments, and two results are returned
+ -- set default_(model|view), current_(model|view) or current_(model|view)_instance
+ instead
+ 2) you call a component resolution method with a string, and it resorts to a regexp
+ fallback wherein a result is returned -- if you really want to search, call the
+ method with a regex as the argument
+ - remove 0-length query string components so warnings aren't thrown (RT #36428)
+ - Update HTTP::Body dep so that the uploadtmp config value will work (RT #22540)
+ - Fix for LocalRegex when used in the Root controller
+ - Get some of the optional_* tests working from dirs with spaces (RT #26455)
+ - Fix Catalyst::Utils::home() when application .pm is in the current dir (RT #34437)
+ - Added the ability to remove parameters in req->uri_with() by passing in
+ an undef value (RT #34782)
+ - Added $c->go, to do an internal redispatch to another action, while retaining the
+ contents of the stash
+
5.7014 2008-05-25 15:26:00
- - Addition of .conf in restart regex in Catalyst::Engine::HTTP::Restarter::Watcher
- - Fix regression for relative uri_for arguments after a forward()
- introduced in 5.7013 (Peter Karman)
- - Fix regression for "sub foo : Path {}" in the root controller which
- was introduced when attempting to allow "0" as a Path.
+ - Addition of .conf in restart regex in Catalyst::Engine::HTTP::Restarter::Watcher
+ - Fix regression for relative uri_for arguments after a forward()
+ introduced in 5.7013 (Peter Karman)
+ - Fix regression for "sub foo : Path {}" in the root controller which
+ was introduced when attempting to allow "0" as a Path.
5.7013 2008-05-16 18:20:00
- Provide backwards compatability methods in Catalyst::Stats
Modified: Catalyst-Runtime/5.70/branches/proxystuff/Makefile.PL
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/Makefile.PL 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/Makefile.PL 2008-11-03 23:20:57 UTC (rev 8579)
@@ -13,7 +13,7 @@
requires 'Data::Dump';
requires 'File::Modified';
requires 'HTML::Entities';
-requires 'HTTP::Body' => '0.9';
+requires 'HTTP::Body' => '1.04'; # makes uploadtmp work
requires 'HTTP::Headers' => '1.64';
requires 'HTTP::Request';
requires 'HTTP::Response';
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Action.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Action.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Action.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -99,9 +99,9 @@
returns the sub name of this action.
-=head1 AUTHOR
+=head1 AUTHORS
-Matt S. Trout
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/ActionChain.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/ActionChain.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/ActionChain.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -79,12 +79,10 @@
Takes a list of Catalyst::Action objects and constructs and returns a
Catalyst::ActionChain object representing a chain of these actions
-=cut
+=head1 AUTHORS
-=head1 AUTHOR
+Catalyst Contributors, see Catalyst.pm
-Matt S. Trout
-
=head1 COPYRIGHT
This program is free software, you can redistribute it and/or modify it under
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/ActionContainer.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/ActionContainer.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/ActionContainer.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -78,9 +78,9 @@
Accessor to the path part this container resolves to. Also what the container
stringifies to.
-=head1 AUTHOR
+=head1 AUTHORS
-Matt S. Trout
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/AttrContainer.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/AttrContainer.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/AttrContainer.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -23,7 +23,7 @@
=head1 NAME
-Catalyst::AttrContainer
+Catalyst::AttrContainer - Handles code attribute storage and caching
=head1 SYNOPSIS
@@ -47,10 +47,9 @@
L<Catalyst::Dispatcher>
L<Catalyst>.
-=head1 AUTHOR
+=head1 AUTHORS
-Sebastian Riedel, C<sri at cpan.org>
-Marcus Ramberg, C<mramberg at cpan.org>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Base.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Base.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Base.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -20,15 +20,13 @@
L<Catalyst>, L<Catalyst::Controller>.
-=head1 AUTHOR
+=head1 AUTHORS
-Sebastian Riedel, C<sri at cpan.org>
-Marcus Ramberg, C<mramberg at cpan.org>
-Matt S Trout, C<mst at shadowcatsystems.co.uk>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
This program is free software, you can redistribute it and/or modify it under
the same terms as Perl itself.
-=cut
\ No newline at end of file
+=cut
Deleted: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Build.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Build.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Build.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -1,141 +0,0 @@
-package Catalyst::Build;
-
-use strict;
-use Module::Build;
-use Path::Class;
-use File::Find 'find';
-
-our @ISA;
-eval "require Module::Build";
-die "Please install Module::Build\n" if $@;
-push @ISA, 'Module::Build';
-
-our @ignore =
- qw/Build Build.PL Changes MANIFEST META.yml Makefile.PL Makefile README
- _build blib lib script t/;
-
-our $FAKE;
-our $ignore = '^(' . join( '|', @ignore ) . ')$';
-
-=head1 NAME
-
-Catalyst::Build - Module::Build extension for Catalyst
-
-=head1 SYNOPSIS
-
-See L<Catalyst>
-
-=head1 DESCRIPTION
-
-L<Module::Build> extension for Catalyst.
-
-=head1 DEPRECATION NOTICE
-
-This module is deprecated in favor of L<Module::Install::Catalyst>. It's
-only left here for compability with older applications.
-
-=head1 METHODS
-
-=over 4
-
-=item new
-
-=cut
-
-sub new {
- my $class = shift;
- my $self = $class->SUPER::new(@_);
-
- my $app_name = $self->{properties}{module_name};
- warn <<"EOF";
-
- Note:
-
- The use of Build.PL for building and distributing Catalyst
- applications is deprecated in Catalyst 5.58.
-
- We recommend using the new Module::Install-based Makefile
- system. You can generate a new Makefile.PL for your application
- by running:
-
- catalyst.pl -force -makefile $app_name
-
-EOF
-
- return $self;
-}
-
-=item ACTION_install
-
-=cut
-
-sub ACTION_install {
- my $self = shift;
- $self->SUPER::ACTION_install;
- $self->ACTION_install_extras;
-}
-
-=item ACTION_fakeinstall
-
-=cut
-
-sub ACTION_fakeinstall {
- my $self = shift;
- $self->SUPER::ACTION_fakeinstall;
- local $FAKE = 1;
- $self->ACTION_install_extras;
-}
-
-=item ACTION_install_extras
-
-=cut
-
-sub ACTION_install_extras {
- my $self = shift;
- my $prefix = $self->{properties}{destdir} || undef;
- my $sitelib = $self->install_destination('lib');
- my @path = defined $prefix ? ( $prefix, $sitelib ) : ($sitelib);
- my $path = dir( @path, split( '::', $self->{properties}{module_name} ) );
- my @files = $self->_find_extras;
- print "Installing extras to $path\n";
- for (@files) {
- $FAKE
- ? print "$_ -> $path (FAKE)\n"
- : $self->copy_if_modified( $_, $path );
- }
-}
-
-sub _find_extras {
- my $self = shift;
- my @all = glob '*';
- my @files;
- for my $file (@all) {
- next if $file =~ /$ignore/;
- if ( -d $file ) {
- find(
- sub {
- return if -d;
- push @files, $File::Find::name;
- },
- $file
- );
- }
- else { push @files, $file }
- }
- return @files;
-}
-
-=back
-
-=head1 AUTHOR
-
-Sebastian Riedel, C<sri at oook.de>
-
-=head1 LICENSE
-
-This library is free software, you can redistribute it and/or modify it under
-the same terms as Perl itself.
-
-=cut
-
-1;
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Component.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Component.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Component.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -187,11 +187,9 @@
L<Catalyst>, L<Catalyst::Model>, L<Catalyst::View>, L<Catalyst::Controller>.
-=head1 AUTHOR
+=head1 AUTHORS
-Sebastian Riedel, C<sri at cpan.org>
-Marcus Ramberg, C<mramberg at cpan.org>
-Matt S Trout, C<mst at shadowcatsystems.co.uk>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Controller.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Controller.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -270,11 +270,52 @@
sub _parse_LocalRegex_attr {
my ( $self, $c, $name, $value ) = @_;
unless ( $value =~ s/^\^// ) { $value = "(?:.*?)$value"; }
- return ( 'Regex', '^' . $self->path_prefix($c) . "/${value}" );
+
+ my $prefix = $self->path_prefix( $c );
+ $prefix .= '/' if length( $prefix );
+
+ return ( 'Regex', "^${prefix}${value}" );
}
sub _parse_LocalRegexp_attr { shift->_parse_LocalRegex_attr(@_); }
+sub _parse_Chained_attr {
+ my ($self, $c, $name, $value) = @_;
+
+ if (defined($value) && length($value)) {
+ if ($value eq '.') {
+ $value = '/'.$self->action_namespace($c);
+ } elsif (my ($rel, $rest) = $value =~ /^((?:\.{2}\/)+)(.*)$/) {
+ my @parts = split '/', $self->action_namespace($c);
+ my @levels = split '/', $rel;
+
+ $value = '/'.join('/', @parts[0 .. $#parts - @levels], $rest);
+ } elsif ($value !~ m/^\//) {
+ my $action_ns = $self->action_namespace($c);
+
+ if ($action_ns) {
+ $value = '/'.join('/', $action_ns, $value);
+ } else {
+ $value = '/'.$value; # special case namespace '' (root)
+ }
+ }
+ } else {
+ $value = '/'
+ }
+
+ return Chained => $value;
+}
+
+sub _parse_ChainedParent_attr {
+ my ($self, $c, $name, $value) = @_;
+ return $self->_parse_Chained_attr($c, $name, '../'.$name);
+}
+
+sub _parse_PathPrefix_attr {
+ my $self = shift;
+ return PathPart => $self->path_prefix;
+}
+
sub _parse_ActionClass_attr {
my ( $self, $c, $name, $value ) = @_;
unless ( $value =~ s/^\+// ) {
@@ -342,8 +383,8 @@
=head2 $self->path_prefix($c)
-Returns the default path prefix for :Local, :LocalRegex and relative
-:Path actions in this component. Defaults to the action_namespace or
+Returns the default path prefix for :PathPrefix, :Local, :LocalRegex and
+relative :Path actions in this component. Defaults to the action_namespace or
can be overridden from the "path" config key.
=head2 $self->create_action(%args)
@@ -359,10 +400,9 @@
Returns the application instance stored by C<new()>
-=head1 AUTHOR
+=head1 AUTHORS
-Sebastian Riedel, C<sri at oook.de>
-Marcus Ramberg C<mramberg at cpan.org>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Chained.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Chained.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Chained.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -157,7 +157,14 @@
my ($actions, $captures, $action_parts) = $self->recurse_match(
$c, '/'.$action->reverse, \@parts
);
- if ($actions && (!$best_action || $#$action_parts < $#{$best_action->{parts}})){
+ # No best action currently
+ # OR The action has less parts
+ # OR The action has equal parts but less captured data (ergo more defined)
+ if ($actions &&
+ (!$best_action ||
+ $#$action_parts < $#{$best_action->{parts}} ||
+ ($#$action_parts == $#{$best_action->{parts}} &&
+ $#$captures < $#{$best_action->{captures}}))){
$best_action = {
actions => [ $action, @$actions ],
captures=> [ @captures, @$captures ],
@@ -214,26 +221,8 @@
);
}
- my $parent = $chained_attr[0];
+ my $children = ($self->{children_of}{ $chained_attr[0] } ||= {});
- if (defined($parent) && length($parent)) {
- if ($parent eq '.') {
- $parent = '/'.$action->namespace;
- } elsif ($parent !~ m/^\//) {
- if ($action->namespace) {
- $parent = '/'.join('/', $action->namespace, $parent);
- } else {
- $parent = '/'.$parent; # special case namespace '' (root)
- }
- }
- } else {
- $parent = '/'
- }
-
- $action->attributes->{Chained} = [ $parent ];
-
- my $children = ($self->{children_of}{$parent} ||= {});
-
my @path_part = @{ $action->attributes->{PathPart} || [] };
my $part = $action->name;
@@ -480,13 +469,18 @@
C</foo/bar/...>. If you don't specify C<:PathPart> it has the same
effect as using C<:PathPart>, it would default to the action name.
+=item PathPrefix
+
+Sets PathPart to the path_prefix of the current controller.
+
=item Chained
Has to be specified for every child in the chain. Possible values are
-absolute and relative private action paths, with the relatives pointing
-to the current controller, or a single slash C</> to tell Catalyst that
-this is the root of a chain. The attribute C<:Chained> without arguments
-also defaults to the C</> behavior.
+absolute and relative private action paths or a single slash C</> to
+tell Catalyst that this is the root of a chain. The attribute
+C<:Chained> without arguments also defaults to the C</> behavior.
+Relative action paths may use C<../> to refer to actions in parent
+controllers.
Because you can specify an absolute path to the parent action, it
doesn't matter to Catalyst where that parent is located. So, if your
@@ -509,6 +503,19 @@
C</foo/bar>. That action chains directly to C</>, so the C</bar/*/baz/*>
chain comes out as the end product.
+=item ChainedParent
+
+Chains an action to another action with the same name in the parent
+controller. For Example:
+
+ # in MyApp::Controller::Foo
+ sub bar : Chained CaptureArgs(1) { ... }
+
+ # in MyApp::Controller::Foo::Moo
+ sub bar : ChainedParent Args(1) { ... }
+
+This builds a chain like C</bar/*/bar/*>.
+
=item CaptureArgs
Must be specified for every part of the chain that is not an
@@ -555,9 +562,9 @@
you C<detach> out of a chain, the rest of the chain will not get called
after the C<detach>.
-=head1 AUTHOR
+=head1 AUTHORS
-Matt S Trout <mst at shadowcatsystems.co.uk>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Default.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Default.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Default.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -45,10 +45,9 @@
return 0;
}
-=head1 AUTHOR
+=head1 AUTHORS
-Matt S Trout
-Sebastian Riedel, C<sri at cpan.org>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Index.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Index.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Index.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -55,9 +55,9 @@
return "/".$action->namespace;
}
-=head1 AUTHOR
+=head1 AUTHORS
-Sebastian Riedel, C<sri at cpan.org>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Path.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Path.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Path.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -118,10 +118,9 @@
}
}
-=head1 AUTHOR
+=head1 AUTHORS
-Matt S Trout
-Sebastian Riedel, C<sri at cpan.org>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Regex.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Regex.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType/Regex.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -139,10 +139,9 @@
return undef;
}
-=head1 AUTHOR
+=head1 AUTHORS
-Matt S Trout
-Sebastian Riedel, C<sri at cpan.org>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/DispatchType.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -58,10 +58,9 @@
sub uri_for_action { }
-=head1 AUTHOR
+=head1 AUTHORS
-Matt S Trout
-Sebastian Riedel, C<sri at cpan.org>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Dispatcher.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Dispatcher.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Dispatcher.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -127,17 +127,15 @@
}
}
-=head2 $self->forward( $c, $command [, \@arguments ] )
+# $self->_command2action( $c, $command [, \@arguments ] )
+# Search for an action, from the command and returns C<($action, $args)> on
+# success. Returns C<(0)> on error.
-Documented in L<Catalyst>
-
-=cut
-
-sub forward {
+sub _command2action {
my ( $self, $c, $command, @extra_params ) = @_;
unless ($command) {
- $c->log->debug('Nothing to forward to') if $c->debug;
+ $c->log->debug('Nothing to go to') if $c->debug;
return 0;
}
@@ -146,22 +144,38 @@
if ( ref( $extra_params[-1] ) eq 'ARRAY' ) {
@args = @{ pop @extra_params }
} else {
- # this is a copy, it may take some abuse from ->_invoke_as_path if the path had trailing parts
+ # this is a copy, it may take some abuse from
+ # ->_invoke_as_path if the path had trailing parts
@args = @{ $c->request->arguments };
}
my $action;
- # forward to a string path ("/foo/bar/gorch") or action object which stringifies to that
+ # go to a string path ("/foo/bar/gorch")
+ # or action object which stringifies to that
$action = $self->_invoke_as_path( $c, "$command", \@args );
- # forward to a component ( "MyApp::*::Foo" or $c->component("...") - a path or an object)
+ # go to a component ( "MyApp::*::Foo" or $c->component("...")
+ # - a path or an object)
unless ($action) {
my $method = @extra_params ? $extra_params[0] : "process";
$action = $self->_invoke_as_component( $c, $command, $method );
}
+ return $action, \@args;
+}
+=head2 $self->forward( $c, $command [, \@arguments ] )
+
+Documented in L<Catalyst>
+
+=cut
+
+sub forward {
+ my $self = shift;
+ my ( $c, $command ) = @_;
+ my ( $action, $args ) = $self->_command2action(@_);
+
unless ($action) {
my $error =
qq/Couldn't forward to command "$command": /
@@ -171,9 +185,7 @@
return 0;
}
- #push @$args, @_;
-
- local $c->request->{arguments} = \@args;
+ local $c->request->{arguments} = $args;
$action->dispatch( $c );
return $c->state;
@@ -527,10 +539,9 @@
return @loaded;
}
-=head1 AUTHOR
+=head1 AUTHORS
-Sebastian Riedel, C<sri at cpan.org>
-Matt S Trout, C<mst at shadowcatsystems.co.uk>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/CGI.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/CGI.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/CGI.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -221,16 +221,12 @@
=head1 SEE ALSO
-L<Catalyst> L<Catalyst::Engine>.
+L<Catalyst>, L<Catalyst::Engine>
=head1 AUTHORS
-Sebastian Riedel, <sri at cpan.org>
+Catalyst Contributors, see Catalyst.pm
-Christian Hansen, <ch at ngmedia.com>
-
-Andy Grundman, <andy at hybridized.org>
-
=head1 COPYRIGHT
This program is free software, you can redistribute it and/or modify it under
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/FastCGI.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/FastCGI.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/FastCGI.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -399,12 +399,8 @@
=head1 AUTHORS
-Sebastian Riedel, <sri at cpan.org>
+Catalyst Contributors, see Catalyst.pm
-Christian Hansen, <ch at ngmedia.com>
-
-Andy Grundman, <andy at hybridized.org>
-
=head1 THANKS
Bill Moseley, for documentation updates and testing.
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -188,10 +188,8 @@
=head1 AUTHORS
-Sebastian Riedel, <sri at cpan.org>
+Catalyst Contributors, see Catalyst.pm
-Andy Grundman, <andy at hybridized.org>
-
=head1 THANKS
Many parts are ripped out of C<HTTP::Server::Simple> by Jesse Vincent.
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/HTTP/Restarter.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/HTTP/Restarter.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/HTTP/Restarter.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -97,12 +97,8 @@
=head1 AUTHORS
-Sebastian Riedel, <sri at cpan.org>
+Catalyst Contributors, see Catalyst.pm
-Dan Kubb, <dan.kubb-cpan at onautopilot.com>
-
-Andy Grundman, <andy at hybridized.org>
-
=head1 THANKS
Many parts are ripped out of C<HTTP::Server::Simple> by Jesse Vincent.
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/HTTP.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/HTTP.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine/HTTP.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -533,18 +533,12 @@
=head1 SEE ALSO
-L<Catalyst>, L<Catalyst::Engine>.
+L<Catalyst>, L<Catalyst::Engine>
=head1 AUTHORS
-Sebastian Riedel, <sri at cpan.org>
+Catalyst Contributors, see Catalyst.pm
-Dan Kubb, <dan.kubb-cpan at onautopilot.com>
-
-Sascha Kiefer, <esskar at cpan.org>
-
-Andy Grundman, <andy at hybridized.org>
-
=head1 THANKS
Many parts are ripped out of C<HTTP::Server::Simple> by Jesse Vincent.
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Engine.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -157,6 +157,7 @@
(no) Vennligst prov igjen senere
(dk) Venligst prov igen senere
(pl) Prosze sprobowac pozniej
+(pt) Por favor volte mais tarde
</pre>
$name = '';
@@ -314,7 +315,7 @@
unless ( $c->request->{_body} ) {
my $type = $c->request->header('Content-Type');
$c->request->{_body} = HTTP::Body->new( $type, $length );
- $c->request->{_body}->{tmpdir} = $c->config->{uploadtmp}
+ $c->request->{_body}->tmpdir( $c->config->{uploadtmp} )
if exists $c->config->{uploadtmp};
}
@@ -550,7 +551,7 @@
# replace semi-colons
$query_string =~ s/;/&/g;
- my @params = split /&/, $query_string;
+ my @params = grep { length $_ } split /&/, $query_string;
for my $item ( @params ) {
@@ -768,10 +769,8 @@
=head1 AUTHORS
-Sebastian Riedel, <sri at cpan.org>
+Catalyst Contributors, see Catalyst.pm
-Andy Grundman, <andy at hybridized.org>
-
=head1 COPYRIGHT
This program is free software, you can redistribute it and/or modify it under
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Exception.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Exception.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Exception.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -49,10 +49,9 @@
Carp::croak($message);
}
-=head1 AUTHOR
+=head1 AUTHORS
-Sebastian Riedel, C<sri at cpan.org>
-Christian Hansen, C<ch at ngmedia.com>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Log.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Log.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Log.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -221,11 +221,9 @@
L<Catalyst>.
-=head1 AUTHOR
+=head1 AUTHORS
-Sebastian Riedel, C<sri at cpan.org>
-Marcus Ramberg, C<mramberg at cpan.org>
-Christian Hansen, C<ch at ngmedia.com>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Manual.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Manual.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Manual.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -16,9 +16,8 @@
$ perldoc -t Catalyst::Manual::Tutorial::CatalystBasics 2>&1 >/dev/null && echo OK || echo MISSING
If you see "OK" as the output, it's there, if you see "MISSING" you
-need to install the
-L<Catalyst::Manual|http://search.cpan.org/search?query=Catalyst%3A%3AManual&mode=dist>
-distribution.
+need to install the L<Catalyst::Manual> distribution
+(L<http://search.cpan.org/dist/Catalyst-Manual/>).
=over 4
@@ -91,12 +90,13 @@
http://lists.rawmode.org/mailman/listinfo/catalyst
http://lists.rawmode.org/mailman/listinfo/catalyst-dev
-=head1 AUTHOR
+=head1 AUTHORS
-Sebastian Riedel, C<sri at oook.de>
-Jesse Sheidlower, C<jester at panix.com>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
This program is free software, you can redistribute it and/or modify it
under the same terms as Perl itself.
+
+=cut
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Model.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Model.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Model.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -20,9 +20,9 @@
Implements the same methods as other Catalyst components, see
L<Catalyst::Component>
-=head1 AUTHOR
+=head1 AUTHORS
-Sebastian Riedel, C<sri at oook.de>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Request/Upload.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Request/Upload.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Request/Upload.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -34,11 +34,6 @@
__PACKAGE__->config( uploadtmp => '/path/to/tmpdir' );
-It is provided a way to have configurable temporary directory.
-If there is no config uploadtmp, system temprary directory will used.
-
- __PACKAGE__->config( uploadtmp => '/path/to/tmpdir' );
-
See also L<Catalyst>.
=head1 DESCRIPTION
@@ -165,10 +160,8 @@
=head1 AUTHORS
-Sebastian Riedel, C<sri at cpan.org>
+Catalyst Contributors, see Catalyst.pm
-Christian Hansen, C<ch at ngmedia.com>
-
=head1 COPYRIGHT
This program is free software, you can redistribute it and/or modify
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Request.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Request.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Request.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -525,7 +525,8 @@
=head2 $req->uri_with( { key => 'value' } );
Returns a rewritten URI object for the current request. Key/value pairs
-passed in will override existing parameters. Unmodified pairs will be
+passed in will override existing parameters. You can remove an existing
+parameter by passing in an undef value. Unmodified pairs will be
preserved.
=cut
@@ -535,7 +536,7 @@
carp( 'No arguments passed to uri_with()' ) unless $args;
- for my $value ( values %$args ) {
+ foreach my $value ( values %$args ) {
next unless defined $value;
for ( ref $value eq 'ARRAY' ? @$value : $value ) {
$_ = "$_";
@@ -543,11 +544,12 @@
}
};
- my $uri = $self->uri->clone;
-
+ my $uri = $self->uri->clone;
+ my %query = ( %{ $uri->query_form_hash }, %$args );
+
$uri->query_form( {
- %{ $uri->query_form_hash },
- %$args
+ # remove undef values
+ map { defined $query{ $_ } ? ( $_ => $query{ $_ } ) : () } keys %query
} );
return $uri;
}
@@ -564,10 +566,8 @@
=head1 AUTHORS
-Sebastian Riedel, C<sri at cpan.org>
+Catalyst Contributors, see Catalyst.pm
-Marcus Ramberg, C<mramberg at cpan.org>
-
=head1 COPYRIGHT
This program is free software, you can redistribute it and/or modify
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Response.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Response.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Response.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -106,11 +106,17 @@
=head2 $res->redirect( $url, $status )
-Causes the response to redirect to the specified URL.
+Causes the response to redirect to the specified URL. The default status is
+C<302>.
$c->response->redirect( 'http://slashdot.org' );
$c->response->redirect( 'http://slashdot.org', 307 );
+This is a convenience method that sets the Location header to the
+redirect destination, and then sets the response status. You will
+want to C< return; > or C< $c->detach() > to interrupt the normal
+processing flow if you want the redirect to occur straight away.
+
=cut
sub redirect {
@@ -143,10 +149,8 @@
=head1 AUTHORS
-Sebastian Riedel, C<sri at cpan.org>
+Catalyst Contributors, see Catalyst.pm
-Marcus Ramberg, C<mramberg at cpan.org>
-
=head1 COPYRIGHT
This program is free software, you can redistribute it and/or modify
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Runtime.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Runtime.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Runtime.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -7,11 +7,13 @@
# Remember to update this in Catalyst as well!
-our $VERSION='5.7014';
+our $VERSION='5.7099_03';
+$VERSION= eval $VERSION;
+
=head1 NAME
-Catalyst::Runtime - Catalyst Runtime version
+Catalyst::Runtime - The Catalyst Framework Runtime
=head1 SYNOPSIS
@@ -21,9 +23,9 @@
This is the primary class for the Catalyst-Runtime distribution, version 5.70.
-=head1 AUTHOR
+=head1 AUTHORS
-The Catalyst Core Team - see http://catalyst.perl.org/
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Stats.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Stats.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Stats.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -354,11 +354,11 @@
=head1 SEE ALSO
-L<Catalyst>.
+L<Catalyst>
-=head1 AUTHOR
+=head1 AUTHORS
-Jon Schutz
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Test.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Test.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Test.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -21,6 +21,12 @@
request('index.html');
get('index.html');
+ use HTTP::Request::Common;
+ my $response = request POST '/foo', [
+ bar => 'baz',
+ something => 'else'
+ ];
+
# Run tests against a remote server
CATALYST_SERVER='http://localhost:3000/' prove -r -l lib/ t/
@@ -45,8 +51,14 @@
=head1 DESCRIPTION
-Test Catalyst Applications.
+This module allows you to make requests to a Catalyst application either without
+a server, by simulating the environment of an HTTP request using
+L<HTTP::Request::AsCGI> or remotely if you define the CATALYST_SERVER
+environment variable.
+The </get> and </request> functions take either a URI or an L<HTTP::Request>
+object.
+
=head2 METHODS
=head2 get
@@ -104,6 +116,8 @@
=head2 local_request
+Simulate a request using L<HTTP::Request::AsCGI>.
+
=cut
sub local_request {
@@ -183,11 +197,12 @@
=head1 SEE ALSO
-L<Catalyst>.
+L<Catalyst>, L<Test::WWW::Mechanize::Catalyst>,
+L<Test::WWW::Selenium::Catalyst>, L<Test::More>, L<HTTP::Request::Common>
-=head1 AUTHOR
+=head1 AUTHORS
-Sebastian Riedel, C<sri at cpan.org>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Utils.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Utils.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/Utils.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -8,6 +8,7 @@
use URI;
use Class::Inspector;
use Carp qw/croak/;
+use Cwd;
=head1 NAME
@@ -160,6 +161,7 @@
# find the @INC entry in which $file was found
(my $path = $inc_entry) =~ s/$file$//;
+ $path ||= cwd() if !defined $path || !length $path;
my $home = dir($path)->absolute->cleanup;
# pop off /lib and /blib if they're there
@@ -329,10 +331,9 @@
return;
}
-=head1 AUTHOR
+=head1 AUTHORS
-Sebastian Riedel, C<sri at cpan.org>
-Yuval Kogman, C<nothingmuch at woobling.org>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/View.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/View.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst/View.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -52,10 +52,9 @@
=cut
-=head1 AUTHOR
+=head1 AUTHORS
-Sebastian Riedel, C<sri at oook.de>
-Marcus Ramberg, C<mramberg at cpan.org>
+Catalyst Contributors, see Catalyst.pm
=head1 COPYRIGHT
Modified: Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/lib/Catalyst.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -63,7 +63,7 @@
# Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.7014';
+our $VERSION = '5.7099_03';
sub import {
my ( $class, @arguments ) = @_;
@@ -97,7 +97,7 @@
catalyst.pl MyApp
# add models, views, controllers
- script/myapp_create.pl model MyDatabase DBIC::Schema create=dynamic dbi:SQLite:/path/to/db
+ script/myapp_create.pl model MyDatabase DBIC::Schema create=static dbi:SQLite:/path/to/db
script/myapp_create.pl view MyTemplate TT
script/myapp_create.pl controller Search
@@ -414,87 +414,66 @@
$c->error(0);
}
+# search components given a name and some prefixes
+sub _comp_search_prefixes {
+ my ( $c, $name, @prefixes ) = @_;
+ my $appclass = ref $c || $c;
+ my $filter = "^${appclass}::(" . join( '|', @prefixes ) . ')::';
-# search via regex
-sub _comp_search {
- my ( $c, @names ) = @_;
+ # map the original component name to the sub part that we will search against
+ my %eligible = map { my $n = $_; $n =~ s{^$appclass\::[^:]+::}{}; $_ => $n; }
+ grep { /$filter/ } keys %{ $c->components };
- foreach my $name (@names) {
- foreach my $component ( keys %{ $c->components } ) {
- return $c->components->{$component} if $component =~ /$name/i;
- }
- }
+ # undef for a name will return all
+ return keys %eligible if !defined $name;
- return undef;
-}
+ my $query = ref $name ? $name : qr/^$name$/i;
+ my @result = grep { $eligible{$_} =~ m{$query} } keys %eligible;
-# try explicit component names
-sub _comp_explicit {
- my ( $c, @names ) = @_;
+ return map { $c->components->{ $_ } } @result if @result;
- foreach my $try (@names) {
- return $c->components->{$try} if ( exists $c->components->{$try} );
- }
+ # if we were given a regexp to search against, we're done.
+ return if ref $name;
- return undef;
-}
+ # regexp fallback
+ $query = qr/$name/i;
+ @result = map { $c->components->{ $_ } } grep { $eligible{ $_ } =~ m{$query} } keys %eligible;
-# like component, but try just these prefixes before regex searching,
-# and do not try to return "sort keys %{ $c->components }"
-sub _comp_prefixes {
- my ( $c, $name, @prefixes ) = @_;
+ # no results? try against full names
+ if( !@result ) {
+ @result = map { $c->components->{ $_ } } grep { m{$query} } keys %eligible;
+ }
- my $appclass = ref $c || $c;
+ # don't warn if we didn't find any results, it just might not exist
+ if( @result ) {
+ $c->log->warn( qq(Found results for "${name}" using regexp fallback.) );
+ $c->log->warn( 'Relying on the regexp fallback behavior for component resolution is unreliable and unsafe.' );
+ $c->log->warn( 'If you really want to search, pass in a regexp as the argument.' );
+ }
- my @names = map { "${appclass}::${_}::${name}" } @prefixes;
-
- my $comp = $c->_comp_explicit(@names);
- return $comp if defined($comp);
- $comp = $c->_comp_search($name);
- return $comp;
+ return @result;
}
# Find possible names for a prefix
-
sub _comp_names {
my ( $c, @prefixes ) = @_;
-
my $appclass = ref $c || $c;
- my @pre = map { "${appclass}::${_}::" } @prefixes;
+ my $filter = "^${appclass}::(" . join( '|', @prefixes ) . ')::';
- my @names;
-
- COMPONENT: foreach my $comp ($c->component) {
- foreach my $p (@pre) {
- if ($comp =~ s/^$p//) {
- push(@names, $comp);
- next COMPONENT;
- }
- }
- }
-
+ my @names = map { s{$filter}{}; $_; } $c->_comp_search_prefixes( undef, @prefixes );
return @names;
}
-# Return a component if only one matches.
-sub _comp_singular {
- my ( $c, @prefixes ) = @_;
-
- my $appclass = ref $c || $c;
-
- my ( $comp, $rest ) =
- map { $c->_comp_search("^${appclass}::${_}::") } @prefixes;
- return $comp unless $rest;
-}
-
# Filter a component before returning by calling ACCEPT_CONTEXT if available
sub _filter_component {
my ( $c, $comp, @args ) = @_;
+
if ( eval { $comp->can('ACCEPT_CONTEXT'); } ) {
return $comp->ACCEPT_CONTEXT( $c, @args );
}
- else { return $comp }
+
+ return $comp;
}
=head2 COMPONENT ACCESSORS
@@ -508,13 +487,23 @@
If the name is omitted, will return the controller for the dispatched
action.
+If you want to search for controllers, pass in a regexp as the argument.
+
+ # find all controllers that start with Foo
+ my @foo_controllers = $c->controller(qr{^Foo});
+
+
=cut
sub controller {
my ( $c, $name, @args ) = @_;
- return $c->_filter_component( $c->_comp_prefixes( $name, qw/Controller C/ ),
- @args )
- if ($name);
+
+ if( $name ) {
+ my @result = $c->_comp_search_prefixes( $name, qw/Controller C/ );
+ return map { $c->_filter_component( $_, @args ) } @result if ref $name;
+ return $c->_filter_component( $result[ 0 ], @args );
+ }
+
return $c->component( $c->action->class );
}
@@ -527,18 +516,27 @@
Any extra arguments are directly passed to ACCEPT_CONTEXT.
If the name is omitted, it will look for
- - a model object in $c->stash{current_model_instance}, then
+ - a model object in $c->stash->{current_model_instance}, then
- a model name in $c->stash->{current_model}, then
- a config setting 'default_model', or
- check if there is only one model, and return it if that's the case.
+If you want to search for models, pass in a regexp as the argument.
+
+ # find all models that start with Foo
+ my @foo_models = $c->model(qr{^Foo});
+
=cut
sub model {
my ( $c, $name, @args ) = @_;
- return $c->_filter_component( $c->_comp_prefixes( $name, qw/Model M/ ),
- @args )
- if $name;
+
+ if( $name ) {
+ my @result = $c->_comp_search_prefixes( $name, qw/Model M/ );
+ return map { $c->_filter_component( $_, @args ) } @result if ref $name;
+ return $c->_filter_component( $result[ 0 ], @args );
+ }
+
if (ref $c) {
return $c->stash->{current_model_instance}
if $c->stash->{current_model_instance};
@@ -547,19 +545,18 @@
}
return $c->model( $c->config->{default_model} )
if $c->config->{default_model};
- return $c->_filter_component( $c->_comp_singular(qw/Model M/) );
-}
+ my( $comp, $rest ) = $c->_comp_search_prefixes( undef, qw/Model M/);
-=head2 $c->controllers
+ if( $rest ) {
+ $c->log->warn( 'Calling $c->model() will return a random model unless you specify one of:' );
+ $c->log->warn( '* $c->config->{default_model} # the name of the default model to use' );
+ $c->log->warn( '* $c->stash->{current_model} # the name of the model to use for this request' );
+ $c->log->warn( '* $c->stash->{current_model_instance} # the instance of the model to use for this request' );
+ $c->log->warn( 'NB: in version 5.80, the "random" behavior will not work at all.' );
+ }
-Returns the available names which can be passed to $c->controller
-
-=cut
-
-sub controllers {
- my ( $c ) = @_;
- return $c->_comp_names(qw/Controller C/);
+ return $c->_filter_component( $comp );
}
@@ -572,18 +569,27 @@
Any extra arguments are directly passed to ACCEPT_CONTEXT.
If the name is omitted, it will look for
- - a view object in $c->stash{current_view_instance}, then
+ - a view object in $c->stash->{current_view_instance}, then
- a view name in $c->stash->{current_view}, then
- a config setting 'default_view', or
- check if there is only one view, and return it if that's the case.
+If you want to search for views, pass in a regexp as the argument.
+
+ # find all views that start with Foo
+ my @foo_views = $c->view(qr{^Foo});
+
=cut
sub view {
my ( $c, $name, @args ) = @_;
- return $c->_filter_component( $c->_comp_prefixes( $name, qw/View V/ ),
- @args )
- if $name;
+
+ if( $name ) {
+ my @result = $c->_comp_search_prefixes( $name, qw/View V/ );
+ return map { $c->_filter_component( $_, @args ) } @result if ref $name;
+ return $c->_filter_component( $result[ 0 ], @args );
+ }
+
if (ref $c) {
return $c->stash->{current_view_instance}
if $c->stash->{current_view_instance};
@@ -592,9 +598,31 @@
}
return $c->view( $c->config->{default_view} )
if $c->config->{default_view};
- return $c->_filter_component( $c->_comp_singular(qw/View V/) );
+
+ my( $comp, $rest ) = $c->_comp_search_prefixes( undef, qw/View V/);
+
+ if( $rest ) {
+ $c->log->warn( 'Calling $c->view() will return a random view unless you specify one of:' );
+ $c->log->warn( '* $c->config->{default_view} # the name of the default view to use' );
+ $c->log->warn( '* $c->stash->{current_view} # the name of the view to use for this request' );
+ $c->log->warn( '* $c->stash->{current_view_instance} # the instance of the view to use for this request' );
+ $c->log->warn( 'NB: in version 5.80, the "random" behavior will not work at all.' );
+ }
+
+ return $c->_filter_component( $comp );
}
+=head2 $c->controllers
+
+Returns the available names which can be passed to $c->controller
+
+=cut
+
+sub controllers {
+ my ( $c ) = @_;
+ return $c->_comp_names(qw/Controller C/);
+}
+
=head2 $c->models
Returns the available names which can be passed to $c->model
@@ -627,35 +655,52 @@
class. C<< $c->controller >>, C<< $c->model >>, and C<< $c->view >>
should be used instead.
+If C<$name> is a regexp, a list of components matched against the full
+component name will be returned.
+
=cut
sub component {
- my $c = shift;
+ my ( $c, $name, @args ) = @_;
- if (@_) {
+ if( $name ) {
+ my $comps = $c->components;
- my $name = shift;
+ if( !ref $name ) {
+ # is it the exact name?
+ return $c->_filter_component( $comps->{ $name }, @args )
+ if exists $comps->{ $name };
- my $appclass = ref $c || $c;
+ # perhaps we just omitted "MyApp"?
+ my $composed = ( ref $c || $c ) . "::${name}";
+ return $c->_filter_component( $comps->{ $composed }, @args )
+ if exists $comps->{ $composed };
- my @names = (
- $name, "${appclass}::${name}",
- map { "${appclass}::${_}::${name}" }
- qw/Model M Controller C View V/
- );
+ # search all of the models, views and controllers
+ my( $comp ) = $c->_comp_search_prefixes( $name, qw/Model M Controller C View V/ );
+ return $c->_filter_component( $comp, @args ) if $comp;
+ }
- my $comp = $c->_comp_explicit(@names);
- return $c->_filter_component( $comp, @_ ) if defined($comp);
+ # This is here so $c->comp( '::M::' ) works
+ my $query = ref $name ? $name : qr{$name}i;
- $comp = $c->_comp_search($name);
- return $c->_filter_component( $comp, @_ ) if defined($comp);
+ my @result = grep { m{$query} } keys %{ $c->components };
+ return map { $c->_filter_component( $_, @args ) } @result if ref $name;
+
+ if( $result[ 0 ] ) {
+ $c->log->warn( qq(Found results for "${name}" using regexp fallback.) );
+ $c->log->warn( 'Relying on the regexp fallback behavior for component resolution' );
+ $c->log->warn( 'is unreliable and unsafe. You have been warned' );
+ return $c->_filter_component( $result[ 0 ], @args );
+ }
+
+ # I would expect to return an empty list here, but that breaks back-compat
}
+ # fallback
return sort keys %{ $c->components };
}
-
-
=head2 CLASS DATA AND HELPER CLASSES
=head2 $c->config
@@ -909,24 +954,76 @@
$class->setup_finished(1);
}
+=head2 $c->uri_for( $action, \@captures?, @args?, \%query_values? )
+
=head2 $c->uri_for( $path, @args?, \%query_values? )
-Merges path with C<< $c->request->base >> for absolute URIs and with
-C<< $c->namespace >> for relative URIs, then returns a normalized L<URI>
-object. If any args are passed, they are added at the end of the path.
-If the last argument to C<uri_for> is a hash reference, it is assumed to
-contain GET parameter key/value pairs, which will be appended to the URI
-in standard fashion.
+=over
-Note that uri_for is destructive to the passed hashref. Subsequent calls
-with the same hashref may have unintended results.
+=item $action
-Instead of C<$path>, you can also optionally pass a C<$action> object
-which will be resolved to a path using
-C<< $c->dispatcher->uri_for_action >>; if the first element of
-C<@args> is an arrayref it is treated as a list of captures to be passed
-to C<uri_for_action>.
+A Catalyst::Action object representing the Catalyst action you want to
+create a URI for. To get one for an action in the current controller,
+use C<< $c->action('someactionname') >>. To get one from different
+controller, fetch the controller using C<< $c->controller() >>, then
+call C<action_for> on it.
+This method must be used to create URIs for
+L<Catalyst::DispatchType::Chained> actions.
+
+=item $path
+
+The actual path you wish to create a URI for, this is a public path,
+not a private action path.
+
+=item \@captures
+
+If provided, this argument is used to insert values into a I<Chained>
+action in the parts where the definitions contain I<CaptureArgs>. If
+not needed, leave out this argument.
+
+=item @args
+
+If provided, this is used as a list of further path sections to append
+to the URI. In a I<Chained> action these are the equivalent to the
+endpoint L<Args>.
+
+=item \%query_values
+
+If provided, the query_values hashref is used to add query parameters
+to the URI, with the keys as the names, and the values as the values.
+
+=back
+
+Returns a L<URI> object.
+
+ ## Ex 1: a path with args and a query parameter
+ $c->uri_for('user/list', 'short', { page => 2});
+ ## -> ($c->req->base is 'http://localhost:3000/'
+ URI->new('http://localhost:3000/user/list/short?page=2)
+
+ ## Ex 2: a chained view action that captures the user id
+ ## In controller:
+ sub user : Chained('/'): PathPart('myuser'): CaptureArgs(1) {}
+ sub viewuser : Chained('user'): PathPart('view') {}
+
+ ## In uri creating code:
+ my $uaction = $c->controller('Users')->action_for('viewuser');
+ $c->uri_for($uaction, [ 42 ]);
+ ## outputs:
+ URI->new('http://localhost:3000/myuser/42/view')
+
+Creates a URI object using C<< $c->request->base >> and a path. If an
+Action object is given instead of a path, the path is constructed
+using C<< $c->dispatcher->uri_for_action >> and passing it the
+ at captures array, if supplied.
+
+If any query parameters are passed they are added to the end of the
+URI in the usual way.
+
+Note that uri_for is destructive to the passed query values hashref.
+Subsequent calls with the same hashref may have unintended results.
+
=cut
sub uri_for {
@@ -1224,7 +1321,9 @@
my $last = pop( @{ $c->stack } );
if ( my $error = $@ ) {
- if ( !ref($error) and $error eq $DETACH ) { die $DETACH if $c->depth > 1 }
+ if ( !ref($error) and $error eq $DETACH ) {
+ die $DETACH if($c->depth > 1);
+ }
else {
unless ( ref $error ) {
no warnings 'uninitialized';
@@ -1858,6 +1957,11 @@
reference. Items in the array beginning with C<::> will have the
application class name prepended to them.
+All components found will also have any
+L<Devel::InnerPackage|inner packages> loaded and set up as components.
+Note, that modules which are B<not> an I<inner package> of the main
+file namespace loaded will not be instantiated as components.
+
=cut
sub setup_components {
@@ -2390,80 +2494,84 @@
=head2 L<Catalyst::Test> - The test suite.
-=head1 CREDITS
+=head1 PROJECT FOUNDER
-Andy Grundman
+sri: Sebastian Riedel <sri at cpan.org>
-Andy Wardley
+=head1 CONTRIBUTORS
-Andreas Marienborg
+abw: Andy Wardley
+acme: Leon Brocard <leon at astray.com>
+
Andrew Bramble
Andrew Ford
Andrew Ruthven
-Arthur Bergman
+andyg: Andy Grundman <andy at hybridized.org>
-Autrijus Tang
+audreyt: Audrey Tang
-Brian Cassidy
+bricas: Brian Cassidy <bricas at cpan.org>
-Carl Franks
+chansen: Christian Hansen
-Christian Hansen
+chicks: Christopher Hicks
-Christopher Hicks
+dkubb: Dan Kubb <dan.kubb-cpan at onautopilot.com>
-Dan Sully
+Drew Taylor
-Danijel Milicevic
+esskar: Sascha Kiefer
-David Kamholz
+fireartist: Carl Franks <cfranks at cpan.org>
-David Naughton
+gabb: Danijel Milicevic
-Drew Taylor
-
Gary Ashton Jones
Geoff Richards
-Jesse Sheidlower
+jcamacho: Juan Camacho
-Jesse Vincent
-
Jody Belka
Johan Lindstrom
-Juan Camacho
+jon: Jon Schutz <jjschutz at cpan.org>
-Leon Brocard
+marcus: Marcus Ramberg <mramberg at cpan.org>
-Marcus Ramberg
+miyagawa: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
-Matt S Trout
+mst: Matt S. Trout <mst at shadowcatsystems.co.uk>
-Robert Sedlacek
+mugwump: Sam Vilain
-Sam Vilain
+naughton: David Naughton
-Sascha Kiefer
+ningu: David Kamholz <dkamholz at cpan.org>
-Sebastian Willert
+nothingmuch: Yuval Kogman <nothingmuch at woobling.org>
-Tatsuhiko Miyagawa
+numa: Dan Sully <daniel at cpan.org>
-Ulf Edvinsson
+obra: Jesse Vincent
-Yuval Kogman
+omega: Andreas Marienborg
-=head1 AUTHOR
+phaylon: Robert Sedlacek <phaylon at dunkelheit.at>
-Sebastian Riedel, C<sri at oook.de>
+sky: Arthur Bergman
+the_jester: Jesse Sheidlower
+
+Ulf Edvinsson
+
+willert: Sebastian Willert <willert at cpan.org>
+
=head1 LICENSE
This library is free software, you can redistribute it and/or modify it under
Modified: Catalyst-Runtime/5.70/branches/proxystuff/script/catalyst.pl
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/script/catalyst.pl 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/script/catalyst.pl 2008-11-03 23:20:57 UTC (rev 8579)
@@ -154,11 +154,9 @@
=back
-
The application module generated by the C<catalyst.pl> script is functional,
although it reacts to all requests by outputting a friendly welcome screen.
-
=head1 NOTE
Neither C<catalyst.pl> nor the generated helper script will overwrite existing
@@ -171,22 +169,16 @@
changed the generated code (although you do of course have all your code in a
version control system anyway, don't you ...).
-
-
=head1 SEE ALSO
L<Catalyst::Manual>, L<Catalyst::Manual::Intro>
-=head1 AUTHOR
+=head1 AUTHORS
-Sebastian Riedel, C<sri at oook.de>,
-Andrew Ford, C<A.Ford at ford-mason.co.uk>
+Catalyst Contributors, see Catalyst.pm
-
=head1 COPYRIGHT
-Copyright 2004-2005 Sebastian Riedel. All rights reserved.
-
This library is free software, you can redistribute it and/or modify it under
the same terms as Perl itself.
Added: Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained/ParentChain/Relative.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained/ParentChain/Relative.pm (rev 0)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained/ParentChain/Relative.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -0,0 +1,10 @@
+package TestApp::Controller::Action::Chained::ParentChain::Relative;
+use warnings;
+use strict;
+
+use base qw/ Catalyst::Controller /;
+
+# using ../ to go up more than one level
+sub chained_rel_two : Chained('../../one') Args(2) { }
+
+1;
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained/ParentChain.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained/ParentChain.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained/ParentChain.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -10,4 +10,16 @@
#
sub child :Chained('.') :Args(1) { }
+# Should be at /chained/rootdef/*/chained_rel/*/*
+sub chained_rel :Chained('../one') Args(2) {
+}
+
+# Should chain to loose in parent namespace - i.e. at /chained/loose/*/loose/*/*
+sub loose : ChainedParent Args(2) {
+}
+
+# Should be at /chained/cross/*/up_down/*
+sub up_down : Chained('../bar/cross1') Args(1) {
+}
+
1;
Added: Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained/PathPrefix.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained/PathPrefix.pm (rev 0)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained/PathPrefix.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -0,0 +1,12 @@
+package TestApp::Controller::Action::Chained::PathPrefix;
+
+use strict;
+use warnings;
+
+use base qw/Catalyst::Controller/;
+
+# this is kinda the same thing as: sub instance : Path {}
+# it should respond to: /action/chained/pathprefix/*
+sub instance : Chained('/') PathPrefix Args(1) { }
+
+1;
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Chained.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -175,6 +175,16 @@
sub cc_b_link : Chained('cc_b') PathPart('') CaptureArgs(1) { }
sub cc_b_anchor : Chained('cc_b_link') PathPart('anchor.html') Args() { }
+#
+# Test static paths vs. captures
+#
+
+sub apan : Chained('/') CaptureArgs(0) PathPrefix { }
+sub korv : Chained('apan') CaptureArgs(0) PathPart('') { }
+sub wurst : Chained('apan') CaptureArgs(1) PathPart('') { }
+sub static_end : Chained('korv') Args(0) { }
+sub capture_end : Chained('wurst') Args(0) PathPart('') { }
+
sub end :Private {
my ($self, $c) = @_;
return if $c->stash->{no_end};
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/ForwardTo.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/ForwardTo.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/ForwardTo.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -5,7 +5,7 @@
sub uri_check : Private {
my ( $self, $c ) = @_;
- $c->res->body( $c->uri_for('foo/bar') );
+ $c->res->body( $c->uri_for('foo/bar')->path );
}
1;
Added: Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Go.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Go.pm (rev 0)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/Go.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -0,0 +1,90 @@
+package TestApp::Controller::Action::Go;
+
+use strict;
+use base 'TestApp::Controller::Action';
+
+sub one : Local {
+ my ( $self, $c ) = @_;
+ $c->go('two');
+}
+
+sub two : Private {
+ my ( $self, $c ) = @_;
+ $c->go('three');
+}
+
+sub three : Local {
+ my ( $self, $c ) = @_;
+ $c->go( $self, 'four' );
+}
+
+sub four : Private {
+ my ( $self, $c ) = @_;
+ $c->go('/action/go/five');
+}
+
+sub five : Local {
+ my ( $self, $c ) = @_;
+ $c->go('View::Dump::Request');
+}
+
+sub inheritance : Local {
+ my ( $self, $c ) = @_;
+ $c->go('/action/inheritance/a/b/default');
+}
+
+sub global : Local {
+ my ( $self, $c ) = @_;
+ $c->go('/global_action');
+}
+
+sub with_args : Local {
+ my ( $self, $c, $arg ) = @_;
+ $c->go( 'args', [$arg] );
+}
+
+sub with_method_and_args : Local {
+ my ( $self, $c, $arg ) = @_;
+ $c->go( qw/TestApp::Controller::Action::Go args/, [$arg] );
+}
+
+sub args : Local {
+ my ( $self, $c, $val ) = @_;
+ die "passed argument does not match args" unless $val eq $c->req->args->[0];
+ $c->res->body($val);
+}
+
+sub go_die : Local {
+ my ( $self, $c, $val ) = @_;
+ eval { $c->go( 'args', [qq/new/] ) };
+ $c->res->body( $@ ? $@ : "go() did not die" );
+ die $Catalyst::GO;
+}
+
+sub go_chained : Local {
+ my ( $self, $c, $val ) = @_;
+ $c->go('/action/chained/foo/spoon',[1]);
+}
+
+sub args_embed_relative : Local {
+ my ( $self, $c ) = @_;
+ $c->go('embed/ok');
+}
+
+sub args_embed_absolute : Local {
+ my ( $self, $c ) = @_;
+ $c->go('/action/go/embed/ok');
+}
+
+sub embed : Local {
+ my ( $self, $c, $ok ) = @_;
+ $ok ||= 'not ok';
+ $c->res->body($ok);
+}
+
+sub class_go_test_action : Local {
+ my ( $self, $c ) = @_;
+ $c->go(qw/TestApp class_go_test_method/);
+}
+
+1;
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/TestRelative.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/TestRelative.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Action/TestRelative.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -17,4 +17,13 @@
$c->forward( 'TestApp::Controller::Action::Forward', 'one' );
}
+sub relative_go : Local {
+ my ( $self, $c ) = @_;
+ $c->go('/action/go/one');
+}
+
+sub relative_go_two : Local {
+ my ( $self, $c ) = @_;
+ $c->go( 'TestApp::Controller::Action::Go', 'one' );
+}
1;
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Args.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Args.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Args.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -2,7 +2,6 @@
use strict;
use base 'Catalyst::Base';
-use Data::Dumper;
sub args :Local {
my ( $self, $c ) = @_;
@@ -14,4 +13,4 @@
$c->res->body( join('', at _) );
}
-1;
\ No newline at end of file
+1;
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Engine/Request/URI.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Engine/Request/URI.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Engine/Request/URI.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -77,4 +77,26 @@
$c->forward('TestApp::View::Dump::Request');
}
+sub uri_with_undef_only : Local {
+ my ( $self, $c ) = @_;
+
+ my $uri = $c->req->uri_with( { a => undef } );
+
+ $c->res->header( 'X-Catalyst-uri-with' => "$uri" );
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub uri_with_undef_ignore : Local {
+ my ( $self, $c ) = @_;
+
+ my $uri = $c->req->uri_with( { a => 1, b => undef } );
+
+ my %query = $uri->query_form;
+ $c->res->header( 'X-Catalyst-uri-with' => "$uri" );
+ $c->res->header( 'X-Catalyst-Param-a' => $query{ a } );
+ $c->res->header( 'X-Catalyst-Param-b' => $query{ b } );
+ $c->res->header( 'X-Catalyst-Param-c' => $query{ c } );
+ $c->forward('TestApp::View::Dump::Request');
+}
+
1;
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Engine/Response/Cookies.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Engine/Response/Cookies.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Engine/Response/Cookies.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -5,15 +5,15 @@
sub one : Local {
my ( $self, $c ) = @_;
- $c->res->cookies->{Catalyst} = { value => 'Cool', path => '/bah' };
- $c->res->cookies->{Cool} = { value => 'Catalyst', path => '/' };
+ $c->res->cookies->{catalyst} = { value => 'cool', path => '/bah' };
+ $c->res->cookies->{cool} = { value => 'catalyst', path => '/' };
$c->forward('TestApp::View::Dump::Request');
}
sub two : Local {
my ( $self, $c ) = @_;
- $c->res->cookies->{Catalyst} = { value => 'Cool', path => '/bah' };
- $c->res->cookies->{Cool} = { value => 'Catalyst', path => '/' };
+ $c->res->cookies->{catalyst} = { value => 'cool', path => '/bah' };
+ $c->res->cookies->{cool} = { value => 'catalyst', path => '/' };
$c->res->redirect('http://www.google.com/');
}
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Root.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp/Controller/Root.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -13,4 +13,11 @@
$c->forward('TestApp::View::Dump::Request');
}
+sub localregex : LocalRegex('^localregex$') {
+ my ( $self, $c ) = @_;
+ $c->res->header( 'X-Test-Class' => ref($self) );
+ $c->response->content_type('text/plain; charset=utf-8');
+ $c->forward('TestApp::View::Dump::Request');
+}
+
1;
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp.pm
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp.pm 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/lib/TestApp.pm 2008-11-03 23:20:57 UTC (rev 8579)
@@ -72,6 +72,11 @@
$c->response->headers->header( 'X-Class-Forward-Test-Method' => 1 );
}
+sub class_go_test_method :Private {
+ my ( $self, $c ) = @_;
+ $c->response->headers->header( 'X-Class-Go-Test-Method' => 1 );
+}
+
sub loop_test : Local {
my ( $self, $c ) = @_;
@@ -98,4 +103,4 @@
use base qw/Catalyst::Base Class::Data::Inheritable/;
-1;
\ No newline at end of file
+1;
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/live_component_controller_action_chained.t
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/live_component_controller_action_chained.t 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/live_component_controller_action_chained.t 2008-11-03 23:20:57 UTC (rev 8579)
@@ -10,7 +10,7 @@
BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 124*$iters;
+use Test::More tests => 141*$iters;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
@@ -528,6 +528,86 @@
}
#
+ # Test if :Chained('../act') is working
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->one
+ TestApp::Controller::Action::Chained::ParentChain->chained_rel
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/one/1/chained_rel/3/2'),
+ ":Chained('../action') chains to correct action" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 3, 2', 'Content OK' );
+ }
+
+ #
+ # Test if ../ works to go up more than one level
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->one
+ TestApp::Controller::Action::Chained::ParentChain::Relative->chained_rel_two
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/one/1/chained_rel_two/42/23'),
+ "../ works to go up more than one level" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 42, 23', 'Content OK' );
+ }
+
+ #
+ # Test if :ChainedParent is working
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->loose
+ TestApp::Controller::Action::Chained::ParentChain->loose
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/loose/4/loose/a/b'),
+ ":Chained('../action') chains to correct action" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '4; a, b', 'Content OK' );
+ }
+
+ #
+ # Test if :Chained('../name/act') is working
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::Bar->cross1
+ TestApp::Controller::Action::Chained::ParentChain->up_down
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/cross/4/up_down/5'),
+ ":Chained('../action') chains to correct action" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '4; 5', 'Content OK' );
+ }
+
+ #
# Test behaviour of auto actions returning '1' for the chain.
#
{
@@ -863,4 +943,42 @@
}
+ #
+ # PathPrefix
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::PathPrefix->instance
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/chained/pathprefix/1'),
+ "PathPrefix (as an endpoint)" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 1', 'Content OK' );
+ }
+
+ #
+ # static paths vs. captures
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->apan
+ TestApp::Controller::Action::Chained->korv
+ TestApp::Controller::Action::Chained->static_end
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/chained/static_end'),
+ "static paths are prefered over captures" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ }
}
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/live_component_controller_action_forward.t
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/live_component_controller_action_forward.t 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/live_component_controller_action_forward.t 2008-11-03 23:20:57 UTC (rev 8579)
@@ -242,8 +242,7 @@
'forward_to_uri_check request');
ok( $response->is_success, 'forward_to_uri_check successful');
- is( $response->content, 'http://localhost/action/forward/foo/bar',
+ is( $response->content, '/action/forward/foo/bar',
'forward_to_uri_check correct namespace');
}
-
}
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/live_component_controller_action_regexp.t
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/live_component_controller_action_regexp.t 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/live_component_controller_action_regexp.t 2008-11-03 23:20:57 UTC (rev 8579)
@@ -10,7 +10,7 @@
BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 28*$iters;
+use Test::More tests => 33*$iters;
use Catalyst::Test 'TestApp';
use Catalyst::Request;
@@ -103,4 +103,19 @@
is( $req->captures->[ 0 ], 'mandatory', 'mandatory capture' );
is( $req->captures->[ 1 ], '/optional', 'optional capture' );
}
+
+ # test localregex in the root controller
+ {
+ ok( my $response = request('http://localhost/localregex'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ '^localregex$', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Root',
+ 'Test Class'
+ );
+ }
}
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/live_engine_request_parameters.t
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/live_engine_request_parameters.t 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/live_engine_request_parameters.t 2008-11-03 23:20:57 UTC (rev 8579)
@@ -6,7 +6,7 @@
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 40;
+use Test::More tests => 53;
use Catalyst::Test 'TestApp';
use Catalyst::Request;
@@ -137,3 +137,26 @@
ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
is( $creq->{uri}->query, 'x=1&y=1&z=1', 'Catalyst::Request GET query_string' );
}
+
+{
+ my $creq;
+ ok( my $response = request("http://localhost/dump/request?&&q="),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ ok( eval '$creq = ' . $response->content );
+ is( keys %{$creq->{parameters}}, 1, 'remove empty parameter' );
+ is( $creq->{parameters}->{q}, '', 'empty parameter' );
+}
+
+{
+ my $creq;
+ ok( my $response = request("http://localhost/dump/request?&0&q="),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ ok( eval '$creq = ' . $response->content );
+ is( keys %{$creq->{parameters}}, 2, 'remove empty parameter' );
+ is( $creq->{parameters}->{q}, '', 'empty parameter' );
+ ok( !defined $creq->{parameters}->{0}, 'empty parameter' );
+}
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/live_engine_request_uploads.t
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/live_engine_request_uploads.t 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/live_engine_request_uploads.t 2008-11-03 23:20:57 UTC (rev 8579)
@@ -6,7 +6,7 @@
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 75;
+use Test::More tests => 88;
use Catalyst::Test 'TestApp';
use Catalyst::Request;
@@ -14,6 +14,7 @@
use HTTP::Headers;
use HTTP::Headers::Util 'split_header_words';
use HTTP::Request::Common;
+use Path::Class::Dir;
{
my $creq;
@@ -242,3 +243,63 @@
is( $upload->filename, 'catalyst_130pix.gif' );
}
}
+
+# test uploadtmp config var
+
+{
+ my $creq;
+
+ my $dir = "$FindBin::Bin/";
+ local TestApp->config->{ uploadtmp } = $dir;
+ $dir = Path::Class::Dir->new( $dir );
+
+ my $request = POST(
+ 'http://localhost/dump/request/',
+ 'Content-Type' => 'multipart/form-data',
+ 'Content' => [
+ 'testfile' => ["$FindBin::Bin/live_engine_request_uploads.t"],
+ ]
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+
+ {
+ no strict 'refs';
+ ok(
+ eval '$creq = ' . $response->content,
+ 'Unserialize Catalyst::Request'
+ );
+ }
+
+ isa_ok( $creq, 'Catalyst::Request' );
+ is( $creq->method, 'POST', 'Catalyst::Request method' );
+ is( $creq->content_type, 'multipart/form-data',
+ 'Catalyst::Request Content-Type' );
+ is( $creq->content_length, $request->content_length,
+ 'Catalyst::Request Content-Length' );
+
+ for my $part ( $request->parts ) {
+
+ my $disposition = $part->header('Content-Disposition');
+ my %parameters = @{ ( split_header_words($disposition) )[0] };
+
+ next unless exists $parameters{filename};
+
+ my $upload = $creq->{uploads}->{ $parameters{name} };
+
+ isa_ok( $upload, 'Catalyst::Request::Upload' );
+
+ is( $upload->type, $part->content_type, 'Upload Content-Type' );
+ is( $upload->size, length( $part->content ), 'Upload Content-Length' );
+
+ like( $upload->tempname, qr{\Q$dir\E}, 'uploadtmp' );
+ }
+}
+
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/live_engine_request_uri.t
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/live_engine_request_uri.t 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/live_engine_request_uri.t 2008-11-03 23:20:57 UTC (rev 8579)
@@ -1,12 +1,10 @@
-#!perl
-
use strict;
use warnings;
use FindBin;
use lib "$FindBin::Bin/lib";
-use Test::More tests => 49;
+use Test::More tests => 66;
use Catalyst::Test 'TestApp';
use Catalyst::Request;
@@ -120,3 +118,36 @@
is( $response->header( 'X-Catalyst-warnings' ), 0, 'no warnings emitted' );
}
+# more tests with undef - should be ignored
+{
+ my $uri = "http://localhost/engine/request/uri/uri_with_undef_only";
+ ok( my $response = request($uri), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-uri-with' ), $uri, 'uri_with ok' );
+
+ # try with existing param
+ $uri = "$uri?x=1";
+ ok( $response = request($uri), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-uri-with' ), $uri, 'uri_with ok' );
+}
+
+{
+ my $uri = "http://localhost/engine/request/uri/uri_with_undef_ignore";
+ ok( my $response = request($uri), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-uri-with' ), "${uri}?a=1", 'uri_with ok' );
+
+ # remove an existing param
+ ok( $response = request("${uri}?b=1"), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-uri-with' ), "${uri}?a=1", 'uri_with ok' );
+
+ # remove an existing param, leave one, and add a new one
+ ok( $response = request("${uri}?b=1&c=1"), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-Param-a' ), '1', 'param "a" ok' );
+ ok( !defined $response->header( 'X-Catalyst-Param-b' ),'param "b" ok' );
+ is( $response->header( 'X-Catalyst-Param-c' ), '1', 'param "c" ok' );
+}
+
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/live_engine_response_cookies.t
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/live_engine_response_cookies.t 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/live_engine_response_cookies.t 2008-11-03 23:20:57 UTC (rev 8579)
@@ -11,8 +11,8 @@
use HTTP::Headers::Util 'split_header_words';
my $expected = {
- Catalyst => [qw|Catalyst Cool path /bah|],
- Cool => [qw|Cool Catalyst path /|]
+ catalyst => [qw|catalyst cool path /bah|],
+ cool => [qw|cool catalyst path /|]
};
{
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/live_priorities.t
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/live_priorities.t 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/live_priorities.t 2008-11-03 23:20:57 UTC (rev 8579)
@@ -8,7 +8,6 @@
use Test::More tests => 28;
use Catalyst::Test 'TestApp';
-use Data::Dumper;
local $^W = 0;
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/optional_http-server-restart.t
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/optional_http-server-restart.t 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/optional_http-server-restart.t 2008-11-03 23:20:57 UTC (rev 8579)
@@ -1,5 +1,3 @@
-#!perl
-
# This test tests the standalone server's auto-restart feature.
use strict;
@@ -9,6 +7,7 @@
use FindBin;
use LWP::Simple;
use IO::Socket;
+use IPC::Open3;
use Test::More;
use Time::HiRes qw/sleep/;
eval "use Catalyst::Devel 1.0;";
@@ -21,14 +20,17 @@
plan tests => 120;
+my $tmpdir = "$FindBin::Bin/../t/tmp";
+
# clean up
-rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp";
+rmtree $tmpdir if -d $tmpdir;
# create a TestApp and copy the test libs into it
-mkdir "$FindBin::Bin/../t/tmp";
-chdir "$FindBin::Bin/../t/tmp";
-system
- "perl -I$FindBin::Bin/../lib $FindBin::Bin/../script/catalyst.pl TestApp";
+mkdir $tmpdir;
+chdir $tmpdir;
+
+system( 'perl', "-I$FindBin::Bin/../lib", "$FindBin::Bin/../script/catalyst.pl", 'TestApp' );
+
chdir "$FindBin::Bin/..";
File::Copy::Recursive::dircopy( 't/lib', 't/tmp/TestApp/lib' );
@@ -38,9 +40,12 @@
# spawn the standalone HTTP server
my $port = 30000 + int rand( 1 + 10000 );
-my $pid = open my $server,
-"perl -I$FindBin::Bin/../lib $FindBin::Bin/../t/tmp/TestApp/script/testapp_server.pl -port $port -restart 2>&1 |"
- or die "Unable to spawn standalone HTTP server: $!";
+my( $server, $pid );
+$pid = open3( undef, $server, undef,
+ 'perl', "-I$FindBin::Bin/../lib",
+ "$FindBin::Bin/../t/tmp/TestApp/script/testapp_server.pl", '-port',
+ $port, '-restart' )
+ or die "Unable to spawn standalone HTTP server: $!";
# switch to non-blocking reads so we can fail
# gracefully instead of just hanging forever
@@ -167,9 +172,11 @@
"-restartdirectory $app_root/lib/TestApp/Controller/$_"
} qw/Action Engine/;
-$pid = open $server,
-"perl -I$FindBin::Bin/../lib $FindBin::Bin/../t/tmp/TestApp/script/testapp_server.pl -port $port -restart $restartdirs 2>&1 |"
- or die "Unable to spawn standalone HTTP server: $!";
+$pid = open3( undef, $server, undef,
+ 'perl', "-I$FindBin::Bin/../lib",
+ "$FindBin::Bin/../t/tmp/TestApp/script/testapp_server.pl", '-port',
+ $port, '-restart', $restartdirs )
+ or die "Unable to spawn standalone HTTP server: $!";
$server->blocking( 0 );
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/optional_http-server.t
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/optional_http-server.t 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/optional_http-server.t 2008-11-03 23:20:57 UTC (rev 8579)
@@ -1,10 +1,9 @@
-#!perl
-
use strict;
use warnings;
use File::Path;
use FindBin;
+use IPC::Open3;
use IO::Socket;
use Test::More;
@@ -18,13 +17,15 @@
# Run a single test by providing it as the first arg
my $single_test = shift;
+my $tmpdir = "$FindBin::Bin/../t/tmp";
+
# clean up
-rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp";
+rmtree $tmpdir if -d $tmpdir;
# create a TestApp and copy the test libs into it
-mkdir "$FindBin::Bin/../t/tmp";
-chdir "$FindBin::Bin/../t/tmp";
-system "perl -I$FindBin::Bin/../lib $FindBin::Bin/../script/catalyst.pl TestApp";
+mkdir $tmpdir;
+chdir $tmpdir;
+system( 'perl', "-I$FindBin::Bin/../lib", "$FindBin::Bin/../script/catalyst.pl", 'TestApp' );
chdir "$FindBin::Bin/..";
File::Copy::Recursive::dircopy( 't/lib', 't/tmp/TestApp/lib' );
@@ -33,8 +34,9 @@
# spawn the standalone HTTP server
my $port = 30000 + int rand(1 + 10000);
-my $pid = open my $server,
- "perl -I$FindBin::Bin/../lib $FindBin::Bin/../t/tmp/TestApp/script/testapp_server.pl -port $port 2>&1 |"
+my $pid = open3( undef, my $server, undef,
+ 'perl', "-I$FindBin::Bin/../lib",
+ "$FindBin::Bin/../t/tmp/TestApp/script/testapp_server.pl", '-port', $port )
or die "Unable to spawn standalone HTTP server: $!";
# wait for it to start
@@ -46,11 +48,12 @@
# run the testsuite against the HTTP server
$ENV{CATALYST_SERVER} = "http://localhost:$port";
+my $return;
if ( $single_test ) {
- system( "perl -Ilib/ $single_test" );
+ $return = system( "perl -Ilib/ $single_test" );
}
else {
- system( 'prove -r -Ilib/ t/live_*' );
+ $return = system( 'prove -r -Ilib/ t/live_*.t' );
}
# shut it down
@@ -60,7 +63,7 @@
# clean up
rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp";
-ok( 'done' );
+is( $return, 0, 'live tests' );
sub check_port {
my ( $host, $port ) = @_;
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/unit_core_component.t
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/unit_core_component.t 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/unit_core_component.t 2008-11-03 23:20:57 UTC (rev 8579)
@@ -1,4 +1,4 @@
-use Test::More tests => 7;
+use Test::More tests => 22;
use strict;
use warnings;
@@ -12,6 +12,9 @@
use base qw/Catalyst/;
__PACKAGE__->components({ map { ($_, $_) } @complist });
+
+ # this is so $c->log->warn will work
+ __PACKAGE__->setup_log;
}
is(MyApp->comp('MyApp::V::View'), 'MyApp::V::View', 'Explicit return ok');
@@ -20,9 +23,66 @@
is(MyApp->comp('Model'), 'MyApp::M::Model', 'Single part return ok');
-is(MyApp->comp('::M::'), 'MyApp::M::Model', 'Regex return ok');
-
is_deeply([ MyApp->comp() ], \@complist, 'Empty return ok');
+# Is this desired behaviour?
is_deeply([ MyApp->comp('Foo') ], \@complist, 'Fallthrough return ok');
- # Is this desired behaviour?
+
+# regexp behavior
+{
+ is_deeply( [ MyApp->comp( qr{Model} ) ], [ 'MyApp::M::Model'], 'regexp ok' );
+ is_deeply( [ MyApp->comp('MyApp::V::View$') ], [ 'MyApp::V::View' ], 'Explicit return ok');
+ is_deeply( [ MyApp->comp('MyApp::C::Controller$') ], [ 'MyApp::C::Controller' ], 'Explicit return ok');
+ is_deeply( [ MyApp->comp('MyApp::M::Model$') ], [ 'MyApp::M::Model' ], 'Explicit return ok');
+
+ # a couple other varieties for regexp fallback
+ is_deeply( [ MyApp->comp('M::Model') ], [ 'MyApp::M::Model' ], 'Explicit return ok');
+
+ {
+ my $warnings = 0;
+ no warnings 'redefine';
+ local *Catalyst::Log::warn = sub { $warnings++ };
+
+ is_deeply( [ MyApp->comp('::M::Model') ], [ 'MyApp::M::Model' ], 'Explicit return ok');
+ ok( $warnings, 'regexp fallback warnings' );
+
+ $warnings = 0;
+ is_deeply( [ MyApp->comp('Mode') ], [ 'MyApp::M::Model' ], 'Explicit return ok');
+ ok( $warnings, 'regexp fallback warnings' );
+
+ $warnings = 0;
+ is(MyApp->comp('::M::'), 'MyApp::M::Model', 'Regex return ok');
+ ok( $warnings, 'regexp fallback for comp() warns' );
+ }
+
+}
+
+# multiple returns
+{
+ my @expected = qw( MyApp::C::Controller MyApp::M::Model );
+ is_deeply( [ MyApp->comp( qr{::[MC]::} ) ], \@expected, 'multiple results fro regexp ok' );
+}
+
+# failed search
+{
+ is_deeply( scalar MyApp->comp( qr{DNE} ), 0, 'no results for failed search' );
+}
+
+
+#checking @args passed to ACCEPT_CONTEXT
+{
+ my $args;
+
+ no warnings;
+ *MyApp::M::Model::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args};
+
+ MyApp->component('MyApp::M::Model', qw/foo bar/);
+ is_deeply($args, [qw/foo bar/], 'args passed to ACCEPT_CONTEXT ok');
+
+ MyApp->component('M::Model', qw/foo2 bar2/);
+ is_deeply($args, [qw/foo2 bar2/], 'args passed to ACCEPT_CONTEXT ok');
+
+ MyApp->component('Mode', qw/foo3 bar3/);
+ is_deeply($args, [qw/foo3 bar3/], 'args passed to ACCEPT_CONTEXT ok');
+}
+
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/unit_core_mvc.t
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/unit_core_mvc.t 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/unit_core_mvc.t 2008-11-03 23:20:57 UTC (rev 8579)
@@ -1,4 +1,4 @@
-use Test::More tests => 27;
+use Test::More tests => 44;
use strict;
use warnings;
@@ -18,6 +18,9 @@
use base qw/Catalyst/;
__PACKAGE__->components( { map { ( ref($_)||$_ , $_ ) } @complist } );
+
+ # allow $c->log->warn to work
+ __PACKAGE__->setup_log;
}
is( MyApp->view('View'), 'MyApp::V::View', 'V::View ok' );
@@ -39,6 +42,11 @@
is( MyApp->model('M'), 'MyApp::Model::M', 'Model::M ok' );
+# failed search
+{
+ is( MyApp->model('DNE'), undef, 'undef for invalid search' );
+}
+
is_deeply( [ sort MyApp->views ],
[ qw/V View/ ],
'views ok' );
@@ -51,8 +59,15 @@
[ qw/Dummy::Model M Model Test::Object/ ],
'models ok');
-is (MyApp->view , 'MyApp::V::View', 'view() with no defaults ok');
+{
+ my $warnings = 0;
+ no warnings 'redefine';
+ local *Catalyst::Log::warn = sub { $warnings++ };
+ like (MyApp->view , qr/^MyApp\::(V|View)\::/ , 'view() with no defaults returns *something*');
+ ok( $warnings, 'view() w/o a default is random, warnings thrown' );
+}
+
is ( bless ({stash=>{current_view=>'V'}}, 'MyApp')->view , 'MyApp::View::V', 'current_view ok');
my $view = bless {} , 'MyApp::View::V';
@@ -61,8 +76,15 @@
is ( bless ({stash=>{current_view_instance=> $view, current_view=>'MyApp::V::View' }}, 'MyApp')->view , $view,
'current_view_instance precedes current_view ok');
-is (MyApp->model , 'MyApp::M::Model', 'model() with no defaults ok');
+{
+ my $warnings = 0;
+ no warnings 'redefine';
+ local *Catalyst::Log::warn = sub { $warnings++ };
+ like (MyApp->model , qr/^MyApp\::(M|Model)\::/ , 'model() with no defaults returns *something*');
+ ok( $warnings, 'model() w/o a default is random, warnings thrown' );
+}
+
is ( bless ({stash=>{current_model=>'M'}}, 'MyApp')->model , 'MyApp::Model::M', 'current_model ok');
my $model = bless {} , 'MyApp::Model::M';
@@ -79,14 +101,66 @@
is ( bless ({stash=>{}}, 'MyApp')->model , 'MyApp::Model::M', 'default_model ok');
is ( MyApp->model , 'MyApp::Model::M', 'default_model in class method ok');
+# regexp behavior tests
+{
+ # is_deeply is used because regexp behavior means list context
+ is_deeply( [ MyApp->view( qr{^V[ie]+w$} ) ], [ 'MyApp::V::View' ], 'regexp view ok' );
+ is_deeply( [ MyApp->controller( qr{Dummy\::Model$} ) ], [ 'MyApp::Controller::Model::Dummy::Model' ], 'regexp controller ok' );
+ is_deeply( [ MyApp->model( qr{Dum{2}y} ) ], [ 'MyApp::Model::Dummy::Model' ], 'regexp model ok' );
+
+ # object w/ qr{}
+ is_deeply( [ MyApp->model( qr{Test} ) ], [ MyApp->components->{'MyApp::Model::Test::Object'} ], 'Object returned' );
+
+ {
+ my $warnings = 0;
+ no warnings 'redefine';
+ local *Catalyst::Log::warn = sub { $warnings++ };
+
+ # object w/ regexp fallback
+ is_deeply( [ MyApp->model( 'Test' ) ], [ MyApp->components->{'MyApp::Model::Test::Object'} ], 'Object returned' );
+ ok( $warnings, 'regexp fallback warnings' );
+ }
+
+ is_deeply( [ MyApp->view('MyApp::V::View$') ], [ 'MyApp::V::View' ], 'Explicit return ok');
+ is_deeply( [ MyApp->controller('MyApp::C::Controller$') ], [ 'MyApp::C::Controller' ], 'Explicit return ok');
+ is_deeply( [ MyApp->model('MyApp::M::Model$') ], [ 'MyApp::M::Model' ], 'Explicit return ok');
+}
+
+{
+ my @expected = qw( MyApp::C::Controller MyApp::Controller::C );
+ is_deeply( [ sort MyApp->controller( qr{^C} ) ], \@expected, 'multiple controller returns from regexp search' );
+}
+
+{
+ my @expected = qw( MyApp::V::View MyApp::View::V );
+ is_deeply( [ sort MyApp->view( qr{^V} ) ], \@expected, 'multiple view returns from regexp search' );
+}
+
+{
+ my @expected = qw( MyApp::M::Model MyApp::Model::M );
+ is_deeply( [ sort MyApp->model( qr{^M} ) ], \@expected, 'multiple model returns from regexp search' );
+}
+
+# failed search
+{
+ is( scalar MyApp->controller( qr{DNE} ), 0, '0 results for failed search' );
+}
+
#checking @args passed to ACCEPT_CONTEXT
-my $args;
{
+ my $args;
+
no warnings;
*MyApp::Model::M::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args};
*MyApp::View::V::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args};
-}
-MyApp->model('M', qw/foo bar/);
-is_deeply($args, [qw/foo bar/], '$c->model args passed to ACCEPT_CONTEXT ok');
-MyApp->view('V', qw/baz moo/);
-is_deeply($args, [qw/baz moo/], '$c->view args passed to ACCEPT_CONTEXT ok');
+
+ MyApp->model('M', qw/foo bar/);
+ is_deeply($args, [qw/foo bar/], '$c->model args passed to ACCEPT_CONTEXT ok');
+
+ my $x = MyApp->view('V', qw/foo2 bar2/);
+ is_deeply($args, [qw/foo2 bar2/], '$c->view args passed to ACCEPT_CONTEXT ok');
+
+ # regexp fallback
+ MyApp->view('::View::V', qw/foo3 bar3/);
+ is_deeply($args, [qw/foo3 bar3/], 'args passed to ACCEPT_CONTEXT ok');
+}
Modified: Catalyst-Runtime/5.70/branches/proxystuff/t/unit_utils_subdir.t
===================================================================
--- Catalyst-Runtime/5.70/branches/proxystuff/t/unit_utils_subdir.t 2008-10-31 15:27:13 UTC (rev 8578)
+++ Catalyst-Runtime/5.70/branches/proxystuff/t/unit_utils_subdir.t 2008-11-03 23:20:57 UTC (rev 8579)
@@ -1,4 +1,4 @@
-use Test::More tests=>7;
+use Test::More tests => 8;
use strict;
use warnings;
@@ -9,6 +9,7 @@
BEGIN { use_ok 'Catalyst::Utils' }
use FindBin;
+use Path::Class::Dir;
{
$INC{'TestApp.pm'} = "$FindBin::Bin/something/script/foo/../../lib/TestApp.pm";
@@ -30,3 +31,14 @@
like($home, qr{t[\/\\]something}, "has path TestApp/t/something");
unlike($home, qr{[\/\\]script[\/\\]foo}, "doesn't have path /script/foo");
}
+
+{
+ $INC{'TestApp.pm'} = "TestApp.pm";
+ my $dir = "$FindBin::Bin/something";
+ chdir( $dir );
+
+ my $home = Catalyst::Utils::home('TestApp');
+
+ $dir = Path::Class::Dir->new( $dir );
+ is( $home, "$dir", 'same dir loading' );
+}
More information about the Catalyst-commits
mailing list