[Catalyst-commits] r12003 - in
Catalyst-Runtime/5.80/branches/contextual_uri_for: . lib
lib/Catalyst lib/Catalyst/Component lib/Catalyst/DispatchType
lib/Catalyst/Engine lib/Catalyst/Engine/HTTP
lib/Catalyst/Engine/HTTP/Restarter lib/Catalyst/Exception
lib/Catalyst/Manual lib/Catalyst/Manual/Installation script t
t/aggregate t/author t/lib t/lib/ACLTestApp
t/lib/ACLTestApp/Controller t/lib/Catalyst/Plugin/Test
t/lib/PluginTestApp t/lib/PluginTestApp/Controller
t/lib/TestApp/Action t/lib/TestApp/Controller
t/lib/TestApp/Controller/Action t/lib/TestApp/View/Dump
t/lib/TestAppDoubleAutoBug
t/lib/TestAppDoubleAutoBug/Controller t/lib/TestAppEncoding
t/lib/TestAppEncoding/Controller t/lib/TestAppNonMooseController
t/lib/TestAppNonMooseController/Controller
t/lib/TestAppPluginWithConstructor
t/lib/TestAppPluginWithConstructor/Controller
t/lib/TestAppStats t/lib/TestAppStats/Controller
pjfl at dev.catalyst.perl.org
pjfl at dev.catalyst.perl.org
Tue Nov 24 17:19:18 GMT 2009
Author: pjfl
Date: 2009-11-24 17:19:15 +0000 (Tue, 24 Nov 2009)
New Revision: 12003
Added:
Catalyst-Runtime/5.80/branches/contextual_uri_for/Makefile.PL
Catalyst-Runtime/5.80/branches/contextual_uri_for/README
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/AttrContainer.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Build.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP/Restarter.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP/Restarter/
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception/Basic.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception/Interface.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation.pod
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation/
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation/CentOS4.pod
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/04critic.rc
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/c3_appclass_bug.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/c3_mro.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/caf_backcompat.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/custom_live_component_controller_action_auto_doublebug.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/custom_live_path_bug.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_anon.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_attributes.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/meta_method_unneeded.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_controller_actions.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_controller_config.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_controller_namespace.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_action.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_classdata.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_component.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_component_loading.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_component_mro.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_engine_fixenv-iis6.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_engine_fixenv-lighttpd.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_log.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_merge_config_hashes.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_mvc.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_path_to.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_plugin.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_setup.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_setup_log.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_setup_stats.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_uri_for.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_uri_with.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_dispatcher_requestargs_restore.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_load_catalyst_test.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_metaclass_compat_extend_non_moose_controller.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_metaclass_compat_non_moose.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_metaclass_compat_non_moose_controller.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_response.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_utils_env_value.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_utils_prefix.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_utils_request.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/utf8_content_length.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/http-server.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/notabs.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/pod.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/podcoverage.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/custom_exception_class_simple.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/deprecated_appclass_action_warnings.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/ACLTestApp.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/ACLTestApp/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/ACLTestApp/Controller/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/ACLTestApp/Controller/Root.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/DeprecatedActionsInAppClassTestApp.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/PluginTestApp/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/PluginTestApp/Controller/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/PluginTestApp/Controller/Root.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Anon.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/View/Dump/Parameters.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppClassExceptionSimpleTest.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppDoubleAutoBug/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppDoubleAutoBug/Controller/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppDoubleAutoBug/Controller/Root.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppEncoding.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppEncoding/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppEncoding/Controller/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppEncoding/Controller/Root.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/Controller/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/Controller/Foo.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/ControllerBase.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPluginWithConstructor/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPluginWithConstructor/Controller/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPluginWithConstructor/Controller/Root.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppStats/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppStats/Controller/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppStats/Controller/Root.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_action.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_auto.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_auto_doublebug.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_begin.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_chained.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_default.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_detach.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_end.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_forward.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_global.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_index.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_inheritance.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_local.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_multipath.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_path.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_private.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_regexp.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_streaming.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_args.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_body.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_body_demand.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_cookies.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_headers.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_parameters.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_uploads.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_uri.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_cookies.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_errors.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_headers.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_large.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_redirect.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_status.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_setup_basics.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_setup_plugins.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_loop.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_plugin_loaded.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_priorities.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_recursion.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_action_for.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_component_layers.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_uri_for_action.t
Removed:
Catalyst-Runtime/5.80/branches/contextual_uri_for/Makefile.PL
Catalyst-Runtime/5.80/branches/contextual_uri_for/README
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation.pod
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation/
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation/CentOS4.pod
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/http-server.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/notabs.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/pod.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/podcoverage.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/custom_live_component_controller_action_auto_doublebug.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/ACLTestApp/Controller/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/ACLTestApp/Controller/Root.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/PluginTestApp/Controller/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/PluginTestApp/Controller/Root.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppDoubleAutoBug/Controller/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppDoubleAutoBug/Controller/Root.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppEncoding/Controller/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppEncoding/Controller/Root.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/Controller/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/Controller/Foo.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/ControllerBase.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPluginWithConstructor/Controller/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPluginWithConstructor/Controller/Root.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppStats/Controller/
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppStats/Controller/Root.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_controller_namespace.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_log.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_merge_config_hashes.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_path_to.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_utils_env_value.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_utils_prefix.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_utils_request.t
Modified:
Catalyst-Runtime/5.80/branches/contextual_uri_for/
Catalyst-Runtime/5.80/branches/contextual_uri_for/Changes
Catalyst-Runtime/5.80/branches/contextual_uri_for/MANIFEST.SKIP
Catalyst-Runtime/5.80/branches/contextual_uri_for/TODO
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Action.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/ClassData.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Component.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Component/ContextClosure.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Controller.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/DispatchType.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/DispatchType/Chained.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/DispatchType/Path.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/DispatchType/Regex.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Dispatcher.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/CGI.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/FastCGI.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception/Detach.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception/Go.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Request.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Response.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Runtime.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Stats.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Test.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Upgrading.pod
Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Utils.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/script/catalyst.pl
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/02pod.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/03podcoverage.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/04critic.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_auto.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_begin.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_chained.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_default.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_detach.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_forward.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_go.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_index.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_index_or_default.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_path_matchsingle.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_regexp.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_streaming.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_visit.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_view_single.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_engine_request_body.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_engine_request_escaped_path.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_engine_request_headers.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_engine_request_remote_user.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_action_for.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_uri_for_action.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/c3_mro.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/deprecated.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/Catalyst/Plugin/Test/Deprecated.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/Catalyst/Plugin/Test/Plugin.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/PluginTestApp.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Action/TestMyAction.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Action/Chained.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Action/Private.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Action/Streaming.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Dump.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Root.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppDoubleAutoBug.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPathBug.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPluginWithConstructor.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppStats.pm
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/optional_http-server-restart.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/optional_http-server.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_controller_config.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_component.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_component_loading.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_mvc.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_plugin.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_uri_for.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_load_catalyst_test.t
Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_stats.t
Log:
Merged latest trunk changes to contextual_uri_for branch
Property changes on: Catalyst-Runtime/5.80/branches/contextual_uri_for
___________________________________________________________________
Name: svn:ignore
- Catalyst-Runtime-*
META.yml
Makefile.old
.gdb_history
pm_to_blib
nytprof.out
blib
inc
Makefile
.*.swp
+ MANIFEST
MANIFEST.bak
Catalyst-Runtime-*
META.yml
Makefile.old
.gdb_history
pm_to_blib
nytprof.out
blib
inc
Makefile
.*.swp
Name: svk:merge
- 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/compres:7999
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/context_go:8001
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/trunk:8533
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/Catalyst-Test-Updates:8363
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/add_captures_to_visit:9546
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/index_default_fuckage:10646
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/moose:7911
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/namespace_handling_refactor:10655
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
8a9521aa-ff93-41d6-9f87-b05cafcdab40:/local/cat/Catalyst-Runtime/5.80/trunk:8157
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime:8339
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime-jrockway:8342
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime:6511
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime-current:10442
+ 1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst/trunk/Catalyst-Runtime:9763
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/compres:7999
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/branches/context_go:8001
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.70/trunk:8533
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/Catalyst-Test-Updates:8363
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/add_captures_to_visit:9546
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/aggregate_more:11803
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/disable_regex_fallback:11456
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/index_default_fuckage:10646
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/moose:7911
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/namespace_handling_refactor:10655
4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Runtime/5.80/branches/uri_encode_captures_andor_args_take2:11811
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
8a9521aa-ff93-41d6-9f87-b05cafcdab40:/local/cat/Catalyst-Runtime/5.80/trunk:8157
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime:8339
d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst/Catalyst-Runtime-jrockway:8342
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime:6511
e56d974f-7718-0410-8b1c-b347a71765b2:/local/Catalyst-Runtime-current:10442
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/Changes
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/Changes 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/Changes 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,19 +1,211 @@
# This file documents the revision history for Perl extension Catalyst.
Bug fixes:
+ - Fix reporting the wrong Content-Length if the response body is an
+ upgraded string. Strings mean the same thing whether or not they are
+ upgraded, may get upgraded even after they are encoded, and will
+ produce the same output either way, but bytes::length returns too big
+ values for upgraded strings containing characters >127
+ - Make FastCGI compatible with modules which use the fileno call to
+ determine if a file is open (E.g. IPC::Run)
+
+ Refactoring / cleanups:
+ - NoTabs and Pod tests moved to t/author so that they're not run
+ (and then skipped) normally.
+
+ Documentation:
+ - Fix Pod nits in Catalyst::Response (RT#51818)
+
+5.80014_01 2009-11-22 20:01:23
+
+ Bug fixes:
+ - Filehandle now forced to binmode in CGI and FastCGI engines. This appears
+ to correct some UTF-8 issues, but may break people's code which relies
+ on the old behaviour.
+
+ Refactoring / cleanups:
+ - Plugins which inherit from Catalyst::Controller or Catalyst::Component
+ are deprecated and now issue warnings.
+
+5.80014 2009-11-21 02:51:14
+
+ Bug fixes:
+ - Require MooseX::MethodAttributes 0.17. This in turn requires new
+ MooseX::Types to stop warnings in Moose 0.91, and correctly supports
+ role combination of roles containing attributed methods.
+ - Catalyst::Dispatcher::dispatch_types no longer throws deprecated warnings
+ as there is no recommended alternative.
+ - Improved the suggested fix warning when component resolution uses regex
+ fallback for fully qualified component names.
+ - Catalyst::Test::local_request sets ->request on the response.
+ - Log flush moved to the end of setup so that roles and plugins which
+ hook setup_finalize can log things and have them appear in application
+ startup, rather than with the first hit.
+ - Require a newer version of LWP to avoid failing tests.
+ - Stop warnings when actions are forwarded to during dispatch.
+ - Remove warnings for using Catalyst::Dispatcher->dispatch_types as this is a
+ valid method to publicly call on the dispatcher.
+ - Args ($c->request->args) and CaptureArgs ($c->request->captrues)
+ passed to $c->uri_for with an action object ($c->action) will now
+ correctly round-trip when args or captures contain / as it is now
+ correctly uri encoded to %2F.
+
+ Documentation:
+ - Document no-args call to $c->uri_for.
+ - Document all top level application configuration parameters.
+ - Clarify how to fix actions in your application class (which is
+ deprecated and causes warnings).
+ - Pod fixes for ContextClosure.
+ - Fix documentation for go/visit to reference captures and arguments
+ in the correct order.
+ - Update $c->forward and $c->state documentation to address scalar
+ context.
+ - Pod fix in Catalyst::Request (RT#51490)
+ - Pod fixes to refer to ::Controller:: rather than ::C:: as the latter
+ is deprecated (RT#51489)
+
+ New features:
+ - Added disable_component_resolution_regex_fallback config option to
+ switch off (deprecated) regex fallback for component resolution.
+ - Added an nginx-specific behavior to the FastCGI engine to allow
+ proper PATH_INFO and SCRIPT_NAME processing for non-root applications
+ - Enable Catalyst::Utils::home() to find home within Dist::Zilla built
+ distributions
+ - Added the Catalyst::Exception::Interface role defining the interface
+ exception classes need to implement.
+ - Added Catalyst::Exception::Basic as a basic implementation of
+ Catalyst::Exception::Interface and made the existing exception classes
+ use it.
+
+ Refactoring / cleanups:
+ - Remove documentation for the case_sensitive setting
+ - Warning is now emitted at application startup if the case_sensitive
+ setting is turned on. This setting is not used by anyone, not
+ believed to be useful and adds unnecessary complexity to controllers
+ and the dispatcher. If you are using this setting and have good reasons
+ why it should stay then you need to be shouting, now.
+ - Writing to $c->req->body now fails as doing this never makes sense.
+
+5.80013 2009-09-17 11:07:04
+
+ Bug fixes:
+ - Preserve immutable_options when temporarily making a class mutable in
+ Catalyst::ClassData as this is needed by new Class::MOP.
+ This could have potentially caused issues when using the deprecated runtime
+ plugins feature in an application with plugins which define their own new
+ method.
+ - Require new Moose version and new versions of various dependencies
+ to avoid warnings from newest Moose release.
+ - Fix go / visit expecting captures and arguments in reverse order.
+
+ Documentation:
+ - Rework the $c->go documentation to make it more clear.
+ - Additional documentation in Catalyst::Upgrading covering more deprecation
+ warnings.
+
+ Refactoring / cleanups:
+ - Action methods in the application class are deprecated and applications
+ using them will now generate a warning at startup.
+ - The -short option has been removed from catalyst.pl, stopping new
+ applications from being generated using the ::[MVC]:: naming scheme as
+ this is deprecated and generates warnings. RT#49771
+
+5.80012 2009-09-09 19:09:09
+
+ Bug fixes:
+ - Fix t/optional_http-server.t test.
+ - Fix t/optional_http-server-restart.t test.
+ - Fix duplicate components being loaded at setup time, each component is
+ now loaded at most once + tests.
+ - Fix backward compatibility - hash key configured actions are stored in
+ is returned to 'actions'.
+ - Fix get_action_methods returning duplicate methods when a method is both
+ decorated with method attributes and set as an action in config.
+
+ Refactoring / cleanups:
+ - Reduce minimum supported perl version from 5.8.6 to 5.8.4 as there are
+ many people still running/testing this version with no known issues.
+
+ Tests:
+ - Make the optional_http_server.t test an author only test which must be
+ run by authors to stop it being broken again.
+ - Fix recursion warnings in the test suites.
+
+5.80011 2009-08-23 13:48:15
+
+ Bug fixes:
+ - Remove leftovers of the restarter engine. The removed code caused test
+ failures, which weren't apparent for anyone still having an old version
+ installed in @INC.
+
+5.80010 2009-08-21 23:32:15
+
+ Bug fixes:
+ - Fix and add tests for a regression introduced by 5.80008.
+ Catalyst::Engine is now able to send out data from filehandles larger
+ than the default chunksize of 64k again.
+
+5.80009 2009-08-21 22:21:08
+
+ Bug fixes:
+ - Fix and add tests for generating inner packages inside the COMPONENT
+ method, and those packages being correctly registered as components.
+ This fixes Catalyst::Model::DBIC among others.
+
+5.80008 2009-08-21 17:47:30
+
+ Bug fixes:
- Fix replace_constructor warning to actually work if you make your
application class immutable without that option.
- - Fix POD to refer to ->config(key => $val), rather than
- ->config->{key} = $val, as the latter form is deprecated.
+ - Depend on Module::Pluggable 3.9 to prevent a bug wherein components
+ in inner packages might not be registered. This especially affected
+ tests.
+ - Catalyst::Engine::FastCGI - relax the check for versions of Microsoft
+ IIS. Provides compatibility with Windows 2008 R2 as well as
+ (hopefully) future versions.
+ - In tests which depend on the values of environment variables,
+ localise the environment, then delete only relevant environment
+ variables (RT#48555)
+ - Fix issue with Engine::HTTP not sending headers properly in some cases
+ (RT#48623)
+ - Make Catalyst::Engine write at least once when finalizing the response
+ body from a filehandle, even if the write is empty. This avoids fail
+ when trying to send out an empty response body from a filehandle.
+ - Catalyst::Engine::HTTP - Accept a fully qualified absolute URI in the
+ Request-URI of the Request-Line
Refactoring / cleanups:
- Deleted the Restarter engine and its Watcher code. Use the
new Catalyst::Restarter in a recent Catalyst::Devel instead.
- - New unit test for Catalyst::Action 'unit_core_action.t' (groditi)
+ - New unit test for Catalyst::Action 'unit_core_action.t'
+ - Bump minimum supported perl version from 5.8.1 to 5.8.6 as there are
+ known issues with 5.8.3.
+ - Debug output uses dynamic column sizing to create more readable output
+ when using a larger $ENV{COLUMNS} setting. (groditi)
New features:
- - private_path method for Catalyst::Action + docs + tests (groditi)
+ - Added private_path method for Catalyst::Action
+ - Allow uri_for($controller_instance) which will produce a URI
+ for the controller namespace
+ - Break setup_components into two more parts: locate_components and
+ expand_component_module (rjbs)
+ - Allow Components to return anon classed from their COMPONENT method
+ correctly, and have action registration work on Controllers returned
+ as such by adding a catalyst_component_name accessor for all components
+ which returns the component instance's name to be used when building
+ actions etc.
+ - Adding X-Forwarded-Port to allow the frontend proxy to dictate the
+ frontend port (jshirley)
+ - Added Catalyst::Stats->created accessor for the time at the start of
+ the request.
+ Documentation:
+ - Fix POD to refer to ->config(key => $val), rather than
+ ->config->{key} = $val, as the latter form is deprecated.
+ - Clearer docs for the 'uri_for' method.
+ - Fix POD refering to CGI::Cookie. We're using CGI::Simple::Cookie.
+ (Forrest Cahoon)
+
5.80007 2009-06-30 23:54:34
Bug fixes:
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/MANIFEST.SKIP
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/MANIFEST.SKIP 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/MANIFEST.SKIP 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1 +1 @@
-^(?!script/\w+\.pl$|TODO$|lib/.+(?<!ROADMAP)\.p(m|od)$|inc/|t/aggregate/.*\.t$|t/.*\.(gif|yml|pl|t)$|t/lib/.*\.pm$|t/something/(Makefile.PL|script/foo/bar/for_dist)$|t/conf/extra.conf.in$|Makefile.PL$|README$|MANIFEST$|Changes$|META.yml$)
+^(?!script/\w+\.pl$|TODO$|lib/.+(?<!ROADMAP)\.p(m|od)$|inc/|t/a(uthor|ggregate)/.*\.t$|t/.*\.(gif|yml|pl|t)$|t/lib/.*\.pm$|t/something/(Makefile.PL|script/foo/bar/for_dist)$|t/conf/extra.conf.in$|Makefile.PL$|README$|MANIFEST$|Changes$|META.yml$)
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/Makefile.PL
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/Makefile.PL 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/Makefile.PL 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,144 +0,0 @@
-use inc::Module::Install 0.87;
-
-perl_version '5.008001';
-
-name 'Catalyst-Runtime';
-all_from 'lib/Catalyst/Runtime.pm';
-
-requires 'namespace::autoclean';
-requires 'namespace::clean';
-requires 'B::Hooks::EndOfScope' => '0.08';
-requires 'MooseX::Emulate::Class::Accessor::Fast' => '0.00801';
-requires 'Class::MOP' => '0.83';
-requires 'Moose' => '0.78';
-requires 'MooseX::MethodAttributes::Inheritable' => '0.12';
-requires 'Carp';
-requires 'Class::C3::Adopt::NEXT' => '0.07';
-requires 'CGI::Simple::Cookie';
-requires 'Data::Dump';
-requires 'HTML::Entities';
-requires 'HTTP::Body' => '1.04'; # makes uploadtmp work
-requires 'HTTP::Headers' => '1.64';
-requires 'HTTP::Request';
-requires 'HTTP::Response';
-requires 'HTTP::Request::AsCGI' => '0.8';
-requires 'LWP::UserAgent';
-requires 'Module::Pluggable' => '3.01';
-requires 'Path::Class' => '0.09';
-requires 'Scalar::Util';
-requires 'Sub::Exporter';
-requires 'Text::SimpleTable' => '0.03';
-requires 'Time::HiRes';
-requires 'Tree::Simple' => '1.15';
-requires 'Tree::Simple::Visitor::FindByPath';
-requires 'URI' => '1.35';
-requires 'Task::Weaken';
-requires 'Text::Balanced'; # core in 5.8.x but mentioned for completeness
-requires 'MRO::Compat';
-requires 'String::RewritePrefix' => '0.004'; # Catalyst::Utils::resolve_namespace
-
-recommends 'B::Hooks::OP::Check::StashChange';
-
-test_requires 'Class::Data::Inheritable';
-test_requires 'Test::Exception';
-
-# aggregate tests if AGGREGATE_TESTS is set and a recent Test::Aggregate and a Test::Simple it works with is available
-if ($ENV{AGGREGATE_TESTS} && can_use('Test::Simple', '0.88') && can_use('Test::Aggregate', '0.35_05')) {
- author_requires('Test::Aggregate', '0.35_05');
- author_requires('Test::Simple', '0.88');
-}
-else {
- tests join q{ },
- grep { $_ ne 't/aggregate.t' }
- map { glob } qw[t/*.t t/aggregate/*.t];
-}
-
-author_requires(map {; $_ => 0 } qw(
- Test::NoTabs
- Test::Pod
- Test::Pod::Coverage
- Pod::Coverage
-));
-
-if ($Module::Install::AUTHOR) {
- darwin_check_no_resource_forks();
-}
-
-resources(
- 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst',
- 'IRC' => 'irc://irc.perl.org/#catalyst',
- 'license', => 'http://dev.perl.org/licenses/',
- 'homepage', => 'http://dev.catalyst.perl.org/',
- 'repository', => 'http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Runtime/',
-);
-
-install_script glob('script/*.pl');
-auto_install;
-WriteAll;
-
-print <<"EOF";
-
- Important:
-
- This library is for running Catalyst applications.
-
- For development and use of catalyst.pl and myapp_create.pl, make sure
- you also install the development tools package Catalyst::Devel.
-
- perl -MCPANPLUS -e 'install Catalyst::Devel' # or
- perl -MCPAN -e 'install Catalyst::Devel'
-
- To get some commonly used plugins, as well as the TT view and DBIC
- model, install Task::Catalyst in the same way.
-
- Have fun!
-EOF
-
-# NOTE - This is the version number of the _incompatible_ code,
-# not the version number of the fixed version.
-my %conflicts = (
- 'Catalyst::Component::ACCEPT_CONTEXT' => '0.06',
- 'Catalyst::Plugin::ENV' => '9999', # This plugin is just stupid, full stop
- # should have been a core fix.
- 'Catalyst::Plugin::Unicode::Encoding' => '0.2',
- 'Catalyst::Authentication::Credential::HTTP' => '1.009',
- 'Catalyst::Plugin::Session::Store::File' => '0.16',
- 'Catalyst::Plugin::Session' => '0.21',
- 'Catalyst::Plugin::Session::State::Cookie' => '0.10',
- 'Catalyst::Plugin::Session::Store::FastMmap' => '0.09',
- 'Catalyst::Controller::AllowDisable' => '0.03',
- 'Reaction' => '0.001999',
- 'Catalyst::Plugin::Upload::Image::Magick' => '0.03',
- 'Catalyst::Plugin::ConfigLoader' => '0.22', # Older versions work but
- # throw Data::Visitor warns
- 'Catalyst::Devel' => '0.09',
- 'Catalyst::Plugin::SmartURI' => '0.032',
- 'CatalystX::CRUD' => '0.37',
- 'Catalyst::Action::RenderView' => '0.07',
- 'Catalyst::Plugin::DebugCookie' => '0.999002',
- 'Catalyst::Plugin::Authentication' => '0.100091',
- 'CatalystX::Imports' => '0.03',
- 'Catalyst::Plugin::HashedCookies' => '1.03',
- 'Catalyst::Action::REST' => '0.67',
- 'CatalystX::CRUD' => '0.42',
- 'CatalystX::CRUD::Model::RDBO' => '0.20',
-);
-check_conflicts(%conflicts);
-
-# End of script, helper functions below.
-
-sub darwin_check_no_resource_forks {
- if ($^O eq 'darwin') {
- my $osx_ver = `/usr/bin/sw_vers -productVersion`;
- chomp $osx_ver;
-
- # TAR on 10.4 wants COPY_EXTENDED_ATTRIBUTES_DISABLE
- # On 10.5 (Leopard) it wants COPYFILE_DISABLE
- die("Oh, you got Snow Lepoard, snazzy. Please read the man page for tar to find out if Apple renamed COPYFILE_DISABLE again and fix this Makefile.PL please?\n") if $osx_ver =~ /^10.6/;
- my $attr = $osx_ver =~ /^10.5/ ? 'COPYFILE_DISABLE' : 'COPY_EXTENDED_ATTRIBUTES_DISABLE';
-
- makemaker_args(dist => { PREOP => qq{\@if [ "\$\$$attr" != "true" ]; then}.
- qq{ echo "You must set the ENV variable $attr to true,"; }.
- ' echo "to avoid getting resource forks in your dist."; exit 255; fi' });
- }
-}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/Makefile.PL (from rev 4483, trunk/Catalyst/Makefile.PL)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/Makefile.PL (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/Makefile.PL 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,163 @@
+use strict;
+use warnings;
+use inc::Module::Install 0.87;
+{ # Ensure that these get used - yes, M::I loads them for us, but if you're
+ # in author mode and don't have them installed, then the error is tres
+ # cryptic.
+ no warnings 'redefine';
+ use Module::Install::AuthorRequires;
+ use Module::Install::CheckConflicts;
+ use Module::Install::AuthorTests;
+}
+
+perl_version '5.008004';
+
+name 'Catalyst-Runtime';
+all_from 'lib/Catalyst/Runtime.pm';
+
+requires 'List::MoreUtils';
+requires 'namespace::autoclean' => '0.09';
+requires 'namespace::clean';
+requires 'B::Hooks::EndOfScope' => '0.08';
+requires 'MooseX::Emulate::Class::Accessor::Fast' => '0.00903';
+requires 'Class::MOP' => '0.83';
+requires 'Moose' => '0.90';
+requires 'MooseX::MethodAttributes::Inheritable' => '0.17';
+requires 'MooseX::Role::WithOverloading' => '0.03';
+requires 'Carp';
+requires 'Class::C3::Adopt::NEXT' => '0.07';
+requires 'CGI::Simple::Cookie';
+requires 'Data::Dump';
+requires 'HTML::Entities';
+requires 'HTTP::Body' => '1.04'; # makes uploadtmp work
+requires 'HTTP::Headers' => '1.64';
+requires 'HTTP::Request' => '5.814';
+requires 'HTTP::Response' => '5.813';
+requires 'HTTP::Request::AsCGI' => '0.8';
+requires 'LWP::UserAgent';
+requires 'Module::Pluggable' => '3.9';
+requires 'Path::Class' => '0.09';
+requires 'Scalar::Util';
+requires 'Sub::Exporter';
+requires 'Text::SimpleTable' => '0.03';
+requires 'Time::HiRes';
+requires 'Tree::Simple' => '1.15';
+requires 'Tree::Simple::Visitor::FindByPath';
+requires 'URI' => '1.35';
+requires 'Task::Weaken';
+requires 'Text::Balanced'; # core in 5.8.x but mentioned for completeness
+requires 'MRO::Compat';
+requires 'String::RewritePrefix' => '0.004'; # Catalyst::Utils::resolve_namespace
+
+recommends 'B::Hooks::OP::Check::StashChange';
+
+test_requires 'Class::Data::Inheritable';
+test_requires 'Test::Exception';
+test_requires 'Test::More' => '0.88';
+
+# aggregate tests if AGGREGATE_TESTS is set and a recent Test::Aggregate and a Test::Simple it works with is available
+if ($ENV{AGGREGATE_TESTS} && can_use('Test::Simple', '0.88') && can_use('Test::Aggregate', '0.35_05')) {
+ author_requires('Test::Aggregate', '0.35_05');
+ author_requires('Test::Simple', '0.88');
+}
+else {
+ tests join q{ },
+ grep { $_ ne 't/aggregate.t' }
+ map { glob } qw[t/*.t t/aggregate/*.t];
+}
+author_requires 'CatalystX::LeakChecker', '0.03'; # Skipped if this isn't installed
+author_requires 'File::Copy::Recursive'; # For http server test
+
+author_tests 't/author';
+author_requires(map {; $_ => 0 } qw(
+ Test::NoTabs
+ Test::Pod
+ Test::Pod::Coverage
+ Pod::Coverage
+));
+
+if ($Module::Install::AUTHOR) {
+ darwin_check_no_resource_forks();
+}
+
+resources(
+ 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst',
+ 'IRC' => 'irc://irc.perl.org/#catalyst',
+ 'license', => 'http://dev.perl.org/licenses/',
+ 'homepage', => 'http://dev.catalyst.perl.org/',
+ 'repository', => 'http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Runtime/',
+);
+
+install_script glob('script/*.pl');
+auto_install;
+WriteAll;
+
+print <<"EOF";
+
+ Important:
+
+ This library is for running Catalyst applications.
+
+ For development and use of catalyst.pl and myapp_create.pl, make sure
+ you also install the development tools package Catalyst::Devel.
+
+ perl -MCPANPLUS -e 'install Catalyst::Devel' # or
+ perl -MCPAN -e 'install Catalyst::Devel'
+
+ To get some commonly used plugins, as well as the TT view and DBIC
+ model, install Task::Catalyst in the same way.
+
+ Have fun!
+EOF
+
+# NOTE - This is the version number of the _incompatible_ code,
+# not the version number of the fixed version.
+my %conflicts = (
+ 'Catalyst::Plugin::SubRequest' => '0.14',
+ 'Catalyst::Model::Akismet' => '0.02',
+ 'Catalyst::Component::ACCEPT_CONTEXT' => '0.06',
+ 'Catalyst::Plugin::ENV' => '9999', # This plugin is just stupid, full stop
+ # should have been a core fix.
+ 'Catalyst::Plugin::Unicode::Encoding' => '0.2',
+ 'Catalyst::Authentication::Credential::HTTP' => '1.009',
+ 'Catalyst::Plugin::Session::Store::File' => '0.16',
+ 'Catalyst::Plugin::Session' => '0.21',
+ 'Catalyst::Plugin::Session::State::Cookie' => '0.10',
+ 'Catalyst::Plugin::Session::Store::FastMmap' => '0.09',
+ 'Catalyst::Controller::AllowDisable' => '0.03',
+ 'Reaction' => '0.001999',
+ 'Catalyst::Plugin::Upload::Image::Magick' => '0.03',
+ 'Catalyst::Plugin::ConfigLoader' => '0.22', # Older versions work but
+ # throw Data::Visitor warns
+ 'Catalyst::Devel' => '1.19',
+ 'Catalyst::Plugin::SmartURI' => '0.032',
+ 'CatalystX::CRUD' => '0.37',
+ 'Catalyst::Action::RenderView' => '0.07',
+ 'Catalyst::Plugin::DebugCookie' => '0.999002',
+ 'Catalyst::Plugin::Authentication' => '0.100091',
+ 'CatalystX::Imports' => '0.03',
+ 'Catalyst::Plugin::HashedCookies' => '1.03',
+ 'Catalyst::Action::REST' => '0.67',
+ 'CatalystX::CRUD' => '0.42',
+ 'CatalystX::CRUD::Model::RDBO' => '0.20',
+ 'Catalyst::View::Mason' => '0.17',
+);
+check_conflicts(%conflicts);
+
+# End of script, helper functions below.
+
+sub darwin_check_no_resource_forks {
+ if ($^O eq 'darwin') {
+ my $osx_ver = `/usr/bin/sw_vers -productVersion`;
+ chomp $osx_ver;
+
+ # TAR on 10.4 wants COPY_EXTENDED_ATTRIBUTES_DISABLE
+ # On 10.5 (Leopard) it wants COPYFILE_DISABLE
+ die("Oh, you got Ceiling Cat, snazzy. Please read the man page for tar or Google to find out if Apple renamed COPYFILE_DISABLE (it was COPY_EXTENDED_ATTRIBUTES_DISABLE originally) again and fix this Makefile.PL please?\n") if $osx_ver =~ /^10.7/;
+ my $attr = $osx_ver =~ /^10.(5|6)/ ? 'COPYFILE_DISABLE' : 'COPY_EXTENDED_ATTRIBUTES_DISABLE';
+
+ makemaker_args(dist => { PREOP => qq{\@if [ "\$\$$attr" != "true" ]; then}.
+ qq{ echo "You must set the ENV variable $attr to 'true',"; }.
+ ' echo "to avoid getting resource forks in your dist."; exit 255; fi' });
+ }
+}
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/README
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/README 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/README 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,14 +0,0 @@
-Catalyst-Runtime
-================
-This is the Runtime distribution for the Catalyst MVC framework.
-For more information about Catalyst, write
-
-$ perldoc Catalyst
-
-at the command line, or visit http://www.catalystframework.org/.
-You can also install Catalyst::Manual from CPAN for more
-comprehensive information.
-
-If you are going to write your own Catalyst application, you will
-need to install Catalyst::Devel. Afterwards run catalyst.pl
-for more information about creating your first app.
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/README (from rev 12002, Catalyst-Runtime/5.80/trunk/README)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/README (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/README 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,14 @@
+Catalyst-Runtime
+================
+This is the Runtime distribution for the Catalyst MVC framework.
+For more information about Catalyst, write
+
+$ perldoc Catalyst
+
+at the command line, or visit http://www.catalystframework.org/.
+You can also install Catalyst::Manual from CPAN for more
+comprehensive information.
+
+If you are going to write your own Catalyst application, you will
+need to install Catalyst::Devel. Afterwards run catalyst.pl
+for more information about creating your first app.
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/TODO
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/TODO 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/TODO 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,49 +1,62 @@
-Known Bugs:
+# Known Bugs:
- Bug ->go or ->visit causes actions which have Args or CaptureArgs called
twice when called via ->go or ->visit.
Test app: http://github.com/bobtfish/catalyst-app-bug-go_chain/tree/master
-Compatibility warnings to add:
+ - Bricas' Exception blog post
- - $self->config should warn as config should only ever be called as a
- class method.
+ http://bricas.vox.com/library/post/catalyst-exceptionclass.html
-Proposed functionality / feature additions:
+ Broken by recent exception refactoring
- - Log setup needs to be less lame, so Catalyst::Plugin::Log::* can die
- in a fire. Having $c->log_class would be a good start. kane volunteered
- to do some of this.
+# Compatibility warnings to add:
- Simple example: Catalyst::Plugin::Log::Colorful should just be a
- subclass of Catalyst::Log, no ::Plugin:: needed.
+ - $self->config should warn as config should only ever be called as a
+ class method (TESTS).
- See also: Catalyst::Plugin::Log::Dispatch and
- http://github.com/willert/catalyst-plugin-log4perl-simple/tree
+# Proposed functionality / feature additions:
- Fixes to component interfaces to deal with anon classes:
+## Log setup needs to be less lame
-22:16 <@mst> t0m: explain what breaks
-22:16 <@mst> I'm not 100% sure we have the same problem in mind
-22:17 <@t0m> well, various shit in Catalyst utils to resolve app from MyApp::Controller::Foo breaks
-22:17 <@mst> Caelum: http://scsys.co.uk:8001/31240
-22:17 <@mst> t0m: the trick would be to not need to do that
-22:17 <@mst> t0m: $self->_application should be fine
-22:18 <@t0m> $action->class can't be fed back into $c->component()
-22:18 <@t0m> which breaks ::REST
-22:18 <@mst> right
-22:18 <@mst> we need to
-22:19 <@mst> (a) add an ->_component_name or similar method to controllers
-22:19 <@mst> (b) pass action objects either that or the controller
-22:20 <@t0m> do you have a controller calling $action->dispatch? Course you must, the action lives in a controller..
-22:21 <@mst> and that doesn't matter anyway
-22:21 <@mst> dispatch has $c
-22:21 <@mst> it needs to do
-22:21 <@mst> $c->component($self->_component_name)
-22:21 <@mst> and that _component_name needs to come from the controller at register_actions time
-22:22 <@t0m> confound: Oi, please to be releasing my Action::REST fixes, I'm about to do more..
-22:22 <@t0m> mst: right, gotcha
-22:22 <@mst> note that needs to happen in core
-22:22 <@mst> then actions can use that instead of $self->class
-22:22 <@mst> and shit will work
+So Catalyst::Plugin::Log::* can die
+in a fire. Having $c->log_class would be a good start. kane volunteered
+to do some of this.
+
+Simple example: Catalyst::Plugin::Log::Colorful should just be a
+subclass of Catalyst::Log, no ::Plugin:: needed.
+
+See also: Catalyst::Plugin::Log::Dispatch and
+http://github.com/willert/catalyst-plugin-log4perl-simple/tree
+
+# REFACTORING
+
+## The horrible hack for plugin setup - replacing it:
+
+ * Have a look at the Devel::REPL BEFORE_PLUGIN stuff
+ I wonder if what we need is that combined with plugins-as-roles
+
+## App / ctx split:
+
+ NOTE - these are notes that t0m thought up after doing back compat for
+ catalyst_component_class, may be inaccurate, wrong or missing things
+ bug mst (at least) to correct before trying more than the first 2
+ steps. Please knock yourself out on the first two however :)
+
+ - Eliminate actions in MyApp from the main test suite
+ - Uncomment warning in C::C::register_action_methods, add tests it works
+ by mocking out the logging..
+ - Remove MyApp @ISA controller (ask metaclass if it has attributes, and if
+ so you need back compat :/)
+ - Make Catalyst::Context, move the per request stuff in there, handles from
+ main app class to delegate
+ - Make an instance of the app class which is a global variable
+ - Make new instance of the context class, not the app class per-request
+ - Remove the components as class data, move to instance data on the app
+ class (you probably have to do this for _all_ the class data, good luck!)
+ - Make it possible for users to spin up different instances of the app class
+ (with different config etc each)
+ - Profit! (Things like changing the complete app config per vhost, i.e.
+ writing a config loader / app class role which dispatches per vhost to
+ differently configured apps is piss easy)
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Action.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Action.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Action.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -55,8 +55,6 @@
no warnings 'recursion';
-#__PACKAGE__->mk_accessors(qw/class namespace reverse attributes name code/);
-
sub dispatch { # Execute ourselves against a context
my ( $self, $c ) = @_;
return $c->execute( $self->class, $self );
@@ -84,7 +82,7 @@
my ($a1_args) = @{ $a1->attributes->{Args} || [] };
my ($a2_args) = @{ $a2->attributes->{Args} || [] };
- $_ = looks_like_number($_) ? $_ : ~0
+ $_ = looks_like_number($_) ? $_ : ~0
for $a1_args, $a2_args;
return $a1_args <=> $a2_args;
@@ -105,7 +103,9 @@
=head2 class
-Returns the class name where this action is defined.
+Returns the name of the component where this action is defined.
+Derived by calling the L<Catalyst::Component/catalyst_component_name|catalyst_component_name>
+method on each component.
=head2 code
@@ -113,7 +113,7 @@
=head2 dispatch( $c )
-Dispatch this action against a context
+Dispatch this action against a context.
=head2 execute( $controller, $c, @args )
@@ -145,11 +145,11 @@
=head2 name
-returns the sub name of this action.
+Returns the sub name of this action.
=head2 meta
-Provided by Moose
+Provided by Moose.
=head1 AUTHORS
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/AttrContainer.pm (from rev 4483, trunk/Catalyst/lib/Catalyst/AttrContainer.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/AttrContainer.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/AttrContainer.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,62 @@
+package Catalyst::AttrContainer;
+
+use strict;
+use base qw/Class::Accessor::Fast Class::Data::Inheritable/;
+
+use Catalyst::Exception;
+use NEXT;
+
+__PACKAGE__->mk_classdata($_) for qw/_attr_cache _action_cache/;
+__PACKAGE__->_attr_cache( {} );
+__PACKAGE__->_action_cache( [] );
+
+# note - see attributes(3pm)
+sub MODIFY_CODE_ATTRIBUTES {
+ my ( $class, $code, @attrs ) = @_;
+ $class->_attr_cache( { %{ $class->_attr_cache }, $code => [@attrs] } );
+ $class->_action_cache(
+ [ @{ $class->_action_cache }, [ $code, [@attrs] ] ] );
+ return ();
+}
+
+sub FETCH_CODE_ATTRIBUTES { $_[0]->_attr_cache->{ $_[1] } || () }
+
+=head1 NAME
+
+Catalyst::AttrContainer
+
+=head1 SYNOPSIS
+
+=head1 DESCRIPTION
+
+This class sets up the code attribute cache. It's a base class for
+L<Catalyst::Controller>.
+
+=head1 METHODS
+
+=head2 FETCH_CODE_ATTRIBUTES
+
+Attribute function. See attributes(3pm)
+
+=head2 MODIFY_CODE_ATTRIBUTES
+
+Attribute function. See attributes(3pm)
+
+=head1 SEE ALSO
+
+L<Catalyst::Dispatcher>
+L<Catalyst>.
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri at cpan.org>
+Marcus Ramberg, C<mramberg at cpan.org>
+
+=head1 COPYRIGHT
+
+This program is free software, you can redistribute it and/or modify it under
+the same terms as Perl itself.
+
+=cut
+
+1;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Build.pm (from rev 4483, trunk/Catalyst/lib/Catalyst/Build.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Build.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Build.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,141 @@
+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.80/branches/contextual_uri_for/lib/Catalyst/ClassData.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/ClassData.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/ClassData.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -6,7 +6,7 @@
use Moose::Util ();
sub mk_classdata {
- my ($class, $attribute) = @_;
+ my ($class, $attribute, $warn_on_instance) = @_;
confess("mk_classdata() is a class method, not an object method")
if blessed $class;
@@ -49,13 +49,15 @@
unless $meta->isa('Class::MOP::Class');
my $was_immutable = $meta->is_immutable;
+ my %immutable_options = $meta->immutable_options;
+
$meta->make_mutable if $was_immutable;
my $alias = "_${attribute}_accessor";
$meta->add_method($alias, $accessor);
$meta->add_method($attribute, $accessor);
- $meta->make_immutable if $was_immutable;
+ $meta->make_immutable(%immutable_options) if $was_immutable;
$class->$attribute($_[2]) if(@_ > 2);
return $accessor;
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Component/ContextClosure.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Component/ContextClosure.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Component/ContextClosure.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -22,7 +22,7 @@
package MyApp::Controller::Foo;
use Moose;
- use namespace::autoclean;
+ use namespace::clean -except => 'meta';
BEGIN {
extends 'Catalyst::Controller';
with 'Catalyst::Component::ContextClosure';
@@ -33,7 +33,7 @@
$ctx->stash(a_closure => $self->make_context_closure(sub {
my ($ctx) = @_;
$ctx->response->body('body set from closure');
- }, $ctx);
+ }, $ctx));
}
=head1 DESCRIPTION
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Component.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Component.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Component.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -60,6 +60,18 @@
__PACKAGE__->mk_classdata('_plugins');
__PACKAGE__->mk_classdata('_config');
+has catalyst_component_name => ( is => 'ro' ); # Cannot be required => 1 as context
+ # class @ISA component - HATE
+# Make accessor callable as a class method, as we need to call setup_actions
+# on the application class, which we don't have an instance of, ewwwww
+# Also, naughty modules like Catalyst::View::JSON try to write to _everything_,
+# so spit a warning, ignore that (and try to do the right thing anyway) here..
+around catalyst_component_name => sub {
+ my ($orig, $self) = (shift, shift);
+ Carp::cluck("Tried to write to the catalyst_component_name accessor - is your component broken or just mad? (Write ignored - using default value.)") if scalar @_;
+ blessed($self) ? $self->$orig() || blessed($self) : $self;
+};
+
sub BUILDARGS {
my $class = shift;
my $args = {};
@@ -85,23 +97,24 @@
}
sub COMPONENT {
- my ( $self, $c ) = @_;
+ my ( $class, $c ) = @_;
# Temporary fix, some components does not pass context to constructor
my $arguments = ( ref( $_[-1] ) eq 'HASH' ) ? $_[-1] : {};
- if( my $next = $self->next::can ){
- my $class = blessed $self || $self;
+ if ( my $next = $class->next::can ) {
my ($next_package) = Class::MOP::get_code_info($next);
warn "There is a COMPONENT method resolving after Catalyst::Component in ${next_package}.\n";
warn "This behavior can no longer be supported, and so your application is probably broken.\n";
warn "Your linearized isa hierarchy is: " . join(', ', @{ mro::get_linear_isa($class) }) . "\n";
warn "Please see perldoc Catalyst::Upgrading for more information about this issue.\n";
}
- return $self->new($c, $arguments);
+ return $class->new($c, $arguments);
}
sub config {
my $self = shift;
+ # Uncomment once sane to do so
+ #Carp::cluck("config method called on instance") if ref $self;
my $config = $self->_config || {};
if (@_) {
my $newconfig = { %{@_ > 1 ? {@_} : $_[0]} };
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Controller.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Controller.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Controller.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -2,7 +2,7 @@
use Moose;
use Moose::Util qw/find_meta/;
-
+use List::MoreUtils qw/uniq/;
use namespace::clean -except => 'meta';
BEGIN { extends qw/Catalyst::Component MooseX::MethodAttributes::Inheritable/; }
@@ -29,9 +29,9 @@
predicate => 'has_action_namespace',
);
-has _controller_actions =>
+has actions =>
(
- is => 'rw',
+ accessor => '_controller_actions',
isa => 'HashRef',
init_arg => undef,
);
@@ -44,6 +44,8 @@
$self->_controller_actions($attr_value);
}
+
+
=head1 NAME
Catalyst::Controller - Catalyst Controller base class
@@ -135,28 +137,30 @@
my $orig = shift;
my ( $self, $c ) = @_;
+ my $class = ref($self) || $self;
+ my $appclass = ref($c) || $c;
if( ref($self) ){
return $self->$orig if $self->has_action_namespace;
} else {
- return $self->config->{namespace} if exists $self->config->{namespace};
+ return $class->config->{namespace} if exists $class->config->{namespace};
}
my $case_s;
if( $c ){
- $case_s = $c->config->{case_sensitive};
+ $case_s = $appclass->config->{case_sensitive};
} else {
if ($self->isa('Catalyst')) {
- $case_s = $self->config->{case_sensitive};
+ $case_s = $class->config->{case_sensitive};
} else {
if (ref $self) {
- $case_s = $self->_application->config->{case_sensitive};
+ $case_s = ref($self->_application)->config->{case_sensitive};
} else {
confess("Can't figure out case_sensitive setting");
}
}
}
- my $namespace = Catalyst::Utils::class2prefix(ref($self) || $self, $case_s) || '';
+ my $namespace = Catalyst::Utils::class2prefix($self->catalyst_component_name, $case_s) || '';
$self->$orig($namespace) if ref($self);
return $namespace;
};
@@ -177,8 +181,8 @@
sub get_action_methods {
my $self = shift;
- my $meta = find_meta($self);
- confess("Metaclass for "
+ my $meta = find_meta($self) || confess("No metaclass setup for $self");
+ confess("Metaclass "
. ref($meta) . " for "
. $meta->name
. " cannot support register_actions." )
@@ -190,13 +194,13 @@
@methods,
map {
$meta->find_method_by_name($_)
- || confess( 'Action "'
+ || confess( 'Action "'
. $_
. '" is not available from controller '
. ( ref $self ) )
} keys %{ $self->_controller_actions }
) if ( ref $self );
- return @methods;
+ return uniq @methods;
}
@@ -207,10 +211,18 @@
sub register_action_methods {
my ( $self, $c, @methods ) = @_;
- my $class = ref $self || $self;
+ my $class = $self->catalyst_component_name;
#this is still not correct for some reason.
my $namespace = $self->action_namespace($c);
+ # FIXME - fugly
+ if (!blessed($self) && $self eq $c && scalar(@methods)) {
+ my @really_bad_methods = grep { ! /^_(DISPATCH|BEGIN|AUTO|ACTION|END)$/ } map { $_->name } @methods;
+ if (scalar(@really_bad_methods)) {
+ $c->log->warn("Action methods (" . join(', ', @really_bad_methods) . ") found defined in your application class, $self. This is deprecated, please move them into a Root controller.");
+ }
+ }
+
foreach my $method (@methods) {
my $name = $method->name;
my $attributes = $method->attributes;
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/DispatchType/Chained.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/DispatchType/Chained.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/DispatchType/Chained.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -80,14 +80,16 @@
return unless $self->_endpoints;
- my $column_width = Catalyst::Utils::term_width() - 35 - 9;
+ my $avail_width = Catalyst::Utils::term_width() - 9;
+ my $col1_width = ($avail_width * .50) < 35 ? 35 : int($avail_width * .50);
+ my $col2_width = $avail_width - $col1_width;
my $paths = Text::SimpleTable->new(
- [ 35, 'Path Spec' ], [ $column_width, 'Private' ],
+ [ $col1_width, 'Path Spec' ], [ $col2_width, 'Private' ],
);
my $has_unattached_actions;
my $unattached_actions = Text::SimpleTable->new(
- [ 35, 'Private' ], [ $column_width, 'Missing parent' ],
+ [ $col1_width, 'Private' ], [ $col2_width, 'Missing parent' ],
);
ENDPOINT: foreach my $endpoint (
@@ -397,50 +399,6 @@
return Catalyst::ActionChain->from_chain([reverse @chain]);
}
-=head2 $self->splice_captures_from( $c, $action, $args )
-
-Calculates the number of capture args for the given action,
-splices off the front of the supplied args, and pushes them back
-on the args list wrapped in an array ref
-
-
-=cut
-
-sub splice_captures_from {
- my ($self, $c, $action, $args) = @_; my $attrs = $action->attributes;
-
- return 0 unless ($attrs->{Chained});
-
- if ($attrs->{CaptureArgs}) {
- $c->log->debug( 'Action '.$action->reverse.' is a midpoint' )
- if ($c->debug);
- return 1;
- }
-
- my @captures = ();
- my @chain = @{ $self->expand_action( $action )->chain }; pop @chain;
-
- # Now start from the root of the chain, populate captures
- for my $num_caps (map { $_->attributes->{CaptureArgs}->[0] } @chain) {
- if ($num_caps > scalar @{ $args }) {
- $c->log->debug( 'Action '.$action->reverse.' insufficient args' )
- if ($c->debug);
- return 1;
- }
-
- push @captures, splice @{ $args }, 0, $num_caps;
- }
-
- if (defined $args->[ $attrs->{Args}->[0] ]) {
- $c->log->debug( 'Action '.$action->reverse.' too many args' )
- if ($c->debug);
- }
-
- unshift @{ $args }, \@captures if (defined $captures[0]);
-
- return 1;
-}
-
__PACKAGE__->meta->make_immutable;
=head1 USAGE
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/DispatchType/Path.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/DispatchType/Path.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/DispatchType/Path.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -47,9 +47,11 @@
sub list {
my ( $self, $c ) = @_;
- my $column_width = Catalyst::Utils::term_width() - 35 - 9;
+ my $avail_width = Catalyst::Utils::term_width() - 9;
+ my $col1_width = ($avail_width * .50) < 35 ? 35 : int($avail_width * .50);
+ my $col2_width = $avail_width - $col1_width;
my $paths = Text::SimpleTable->new(
- [ 35, 'Path' ], [ $column_width, 'Private' ]
+ [ $col1_width, 'Path' ], [ $col2_width, 'Private' ]
);
foreach my $path ( sort keys %{ $self->_paths } ) {
my $display_path = $path eq '/' ? $path : "/$path";
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/DispatchType/Regex.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/DispatchType/Regex.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/DispatchType/Regex.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -47,8 +47,12 @@
sub list {
my ( $self, $c ) = @_;
- my $column_width = Catalyst::Utils::term_width() - 35 - 9;
- my $re = Text::SimpleTable->new( [ 35, 'Regex' ], [ $column_width, 'Private' ] );
+ my $avail_width = Catalyst::Utils::term_width() - 9;
+ my $col1_width = ($avail_width * .50) < 35 ? 35 : int($avail_width * .50);
+ my $col2_width = $avail_width - $col1_width;
+ my $re = Text::SimpleTable->new(
+ [ $col1_width, 'Regex' ], [ $col2_width, 'Private' ]
+ );
for my $regex ( @{ $self->_compiled } ) {
my $action = $regex->{action};
$re->row( $regex->{path}, "/$action" );
@@ -164,39 +168,6 @@
return undef;
}
-=head2 $self->splice_captures_from( $c, $action, $args )
-
-Iterates over the regular expressions defined for the action. Stops when
-the number of captures equals the number of supplied args. Replaces the
-list of args with a list containing an array ref of args
-
-=cut
-
-sub splice_captures_from {
- my ($self, $c, $action, $args) = @_; my $regexes;
-
- return 0 unless ($regexes = $action->attributes->{Regex});
-
- foreach my $orig (@{ $regexes }) {
- my $re = "$orig"; $re =~ s/^\^//; $re =~ s/\$$//;
- my $num_caps = 0;
-
- while (my ($front, $rest) = split /\(/, $re, 2) {
- last unless (defined $rest);
-
- ($rest, $re) = Text::Balanced::extract_bracketed( "(${rest}", '(');
- $num_caps++;
- }
-
- next unless ($num_caps == scalar @{ $args });
-
- @{ $args } = ( [ @{ $args } ] );
- return 1;
- }
-
- return 1;
-}
-
=head1 AUTHORS
Catalyst Contributors, see Catalyst.pm
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/DispatchType.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/DispatchType.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/DispatchType.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -73,15 +73,6 @@
sub expand_action { }
-=head2 $self->splice_captures_from
-
-Default fallback, returns nothing. See L<Catalyst::Dispatcher> for more info
-about splice_captures_from.
-
-=cut
-
-sub splice_captures_from { 0 }
-
sub _is_low_precedence { 0 }
=head1 AUTHORS
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Dispatcher.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Dispatcher.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Dispatcher.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -29,7 +29,7 @@
# Note - see back-compat methods at end of file.
has _tree => (is => 'rw', builder => '_build__tree');
-has _dispatch_types => (is => 'rw', default => sub { [] }, required => 1, lazy => 1);
+has dispatch_types => (is => 'rw', default => sub { [] }, required => 1, lazy => 1);
has _registered_dispatch_types => (is => 'rw', default => sub { {} }, required => 1, lazy => 1);
has _method_action_class => (is => 'rw', default => 'Catalyst::Action');
has _action_hash => (is => 'rw', required => 1, lazy => 1, default => sub { {} });
@@ -131,7 +131,7 @@
my (@args, @captures);
if ( ref( $extra_params[-2] ) eq 'ARRAY' ) {
- @captures = @{ pop @extra_params };
+ @captures = @{ splice @extra_params, -2, 1 };
}
if ( ref( $extra_params[-1] ) eq 'ARRAY' ) {
@@ -335,7 +335,7 @@
reverse => "$component_class->$method",
class => $component_class,
namespace => Catalyst::Utils::class2prefix(
- $component_class, $c->config->{case_sensitive}
+ $component_class, ref($c)->config->{case_sensitive}
),
}
);
@@ -372,7 +372,7 @@
# Check out dispatch types to see if any will handle the path at
# this level
- foreach my $type ( @{ $self->_dispatch_types } ) {
+ foreach my $type ( @{ $self->dispatch_types } ) {
last DESCEND if $type->match( $c, $path );
}
@@ -470,7 +470,7 @@
sub uri_for_action {
my ( $self, $action, $captures) = @_;
$captures ||= [];
- foreach my $dispatch_type ( @{ $self->_dispatch_types } ) {
+ foreach my $dispatch_type ( @{ $self->dispatch_types } ) {
my $uri = $dispatch_type->uri_for_action( $action, $captures );
return( $uri eq '' ? '/' : $uri )
if defined($uri);
@@ -489,7 +489,7 @@
sub expand_action {
my ($self, $action) = @_;
- foreach my $dispatch_type (@{ $self->_dispatch_types }) {
+ foreach my $dispatch_type (@{ $self->dispatch_types }) {
my $expanded = $dispatch_type->expand_action($action);
return $expanded if $expanded;
}
@@ -497,31 +497,6 @@
return $action;
}
-=head2 $self->splice_captures_from( $c, $action, $args )
-
-Does nothing if the first element of the list that C<$args> references
-is an array ref. Otherwise calls this method in each dispatch type,
-stopping when the first one returns true
-
-=cut
-
-sub splice_captures_from {
- my ($self, $c, $action, $args) = @_;
-
- return if (!$args || (scalar @{ $args } && ref $args->[0] eq 'ARRAY'));
-
- my $params = scalar @{ $args } && ref $args->[-1] eq 'HASH'
- ? pop @{ $args } : undef;
-
- foreach my $dispatch_type ( @{ $self->_dispatch_types } ) {
- last if ($dispatch_type->splice_captures_from( $c, $action, $args ));
- }
-
- push @{ $args }, $params if ($params); # Restore query parameters
-
- return;
-}
-
=head2 $self->register( $c, $action )
Make sure all required dispatch types for this action are loaded, then
@@ -543,12 +518,12 @@
# FIXME - Some error checking and re-throwing needed here, as
# we eat exceptions loading dispatch types.
eval { Class::MOP::load_class($class) };
- push( @{ $self->_dispatch_types }, $class->new ) unless $@;
+ push( @{ $self->dispatch_types }, $class->new ) unless $@;
$registered->{$class} = 1;
}
}
- my @dtypes = @{ $self->_dispatch_types };
+ my @dtypes = @{ $self->dispatch_types };
my @normal_dtypes;
my @low_precedence_dtypes;
@@ -640,9 +615,12 @@
sub _display_action_tables {
my ($self, $c) = @_;
- my $column_width = Catalyst::Utils::term_width() - 20 - 36 - 12;
+ my $avail_width = Catalyst::Utils::term_width() - 12;
+ my $col1_width = ($avail_width * .25) < 20 ? 20 : int($avail_width * .25);
+ my $col2_width = ($avail_width * .50) < 36 ? 36 : int($avail_width * .50);
+ my $col3_width = $avail_width - $col1_width - $col2_width;
my $privates = Text::SimpleTable->new(
- [ 20, 'Private' ], [ 36, 'Class' ], [ $column_width, 'Method' ]
+ [ $col1_width, 'Private' ], [ $col2_width, 'Class' ], [ $col3_width, 'Method' ]
);
my $has_private = 0;
@@ -669,7 +647,7 @@
if $has_private;
# List all public actions
- $_->list($c) for @{ $self->_dispatch_types };
+ $_->list($c) for @{ $self->dispatch_types };
}
sub _load_dispatch_types {
@@ -684,7 +662,7 @@
eval { Class::MOP::load_class($class) };
Catalyst::Exception->throw( message => qq/Couldn't load "$class"/ )
if $@;
- push @{ $self->_dispatch_types }, $class->new;
+ push @{ $self->dispatch_types }, $class->new;
push @loaded, $class;
}
@@ -706,7 +684,7 @@
# first param is undef because we cannot get the appclass
$name = Catalyst::Utils::resolve_namespace(undef, 'Catalyst::DispatchType', $name);
- for (@{ $self->_dispatch_types }) {
+ for (@{ $self->dispatch_types }) {
return $_ if ref($_) eq $name;
}
return undef;
@@ -744,7 +722,6 @@
# Alias _method_name to method_name, add a before modifier to warn..
foreach my $public_method_name (qw/
tree
- dispatch_types
registered_dispatch_types
method_action_class
action_hash
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/CGI.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/CGI.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/CGI.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -57,9 +57,9 @@
PROXY_CHECK:
{
- unless ( $c->config->{using_frontend_proxy} ) {
+ unless ( ref($c)->config->{using_frontend_proxy} ) {
last PROXY_CHECK if $ENV{REMOTE_ADDR} ne '127.0.0.1';
- last PROXY_CHECK if $c->config->{ignore_frontend_proxy};
+ last PROXY_CHECK if ref($c)->config->{ignore_frontend_proxy};
}
last PROXY_CHECK unless $ENV{HTTP_X_FORWARDED_FOR};
@@ -67,6 +67,9 @@
# as 127.0.0.1. Select the most recent upstream IP (last in the list)
my ($ip) = $ENV{HTTP_X_FORWARDED_FOR} =~ /([^,\s]+)$/;
$request->address($ip);
+ if ( defined $ENV{HTTP_X_FORWARDED_PORT} ) {
+ $ENV{SERVER_PORT} = $ENV{HTTP_X_FORWARDED_PORT};
+ }
}
$request->hostname( $ENV{REMOTE_HOST} ) if exists $ENV{REMOTE_HOST};
@@ -82,6 +85,7 @@
if ( $ENV{SERVER_PORT} == 443 ) {
$request->secure(1);
}
+ binmode(STDOUT); # Ensure we are sending bytes.
}
=head2 $self->prepare_headers($c)
@@ -123,9 +127,9 @@
# If we are running as a backend proxy, get the true hostname
PROXY_CHECK:
{
- unless ( $c->config->{using_frontend_proxy} ) {
+ unless ( ref($c)->config->{using_frontend_proxy} ) {
last PROXY_CHECK if $host !~ /localhost|127.0.0.1/;
- last PROXY_CHECK if $c->config->{ignore_frontend_proxy};
+ last PROXY_CHECK if ref($c)->config->{ignore_frontend_proxy};
}
last PROXY_CHECK unless $ENV{HTTP_X_FORWARDED_HOST};
@@ -134,6 +138,9 @@
# backend could be on any port, so
# assume frontend is on the default port
$port = $c->request->secure ? 443 : 80;
+ if ( $ENV{HTTP_X_FORWARDED_PORT} ) {
+ $port = $ENV{HTTP_X_FORWARDED_PORT};
+ }
}
# set the request URI
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/FastCGI.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/FastCGI.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/FastCGI.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -144,6 +144,11 @@
$self->_fix_env( \%env );
+ # hack for perl libraries that use FILENO (e.g. IPC::Run)
+ # trying to patch FCGI.pm, but not got there yet :/
+ local *FCGI::Stream::FILENO = sub { -2 }
+ unless FCGI::Stream->can('FILENO');
+
$class->handle_request( env => \%env );
$proc_manager && $proc_manager->pm_post_dispatch();
@@ -234,8 +239,13 @@
if ( $env->{SERVER_SOFTWARE} =~ /lighttpd/ ) {
$env->{PATH_INFO} ||= delete $env->{SCRIPT_NAME};
}
- # Fix the environment variables PATH_INFO and SCRIPT_NAME when running under IIS
- elsif ( $env->{SERVER_SOFTWARE} =~ /IIS\/[67].0/ ) {
+ elsif ( $env->{SERVER_SOFTWARE} =~ /^nginx/ ) {
+ my $script_name = $env->{SCRIPT_NAME};
+ $env->{PATH_INFO} =~ s/^$script_name//g;
+ }
+ # Fix the environment variables PATH_INFO and SCRIPT_NAME when running
+ # under IIS
+ elsif ( $env->{SERVER_SOFTWARE} =~ /IIS\/[6-9]\.[0-9]/ ) {
my @script_name = split(m!/!, $env->{PATH_INFO});
my @path_translated = split(m!/|\\\\?!, $env->{PATH_TRANSLATED});
my @path_info;
@@ -433,6 +443,76 @@
For more information on using FastCGI under Lighttpd, visit
L<http://www.lighttpd.net/documentation/fastcgi.html>
+=head2 nginx
+
+Catalyst runs under nginx via FastCGI in a similar fashion as the lighttpd
+standalone server as described above.
+
+nginx does not have its own internal FastCGI process manager, so you must run
+the FastCGI service separately.
+
+=head3 Configuration
+
+To configure nginx, you must configure the FastCGI parameters and also the
+socket your FastCGI daemon is listening on. It can be either a TCP socket
+or a Unix file socket.
+
+The server configuration block should look roughly like:
+
+ server {
+ listen $port;
+
+ location / {
+ fastcgi_param QUERY_STRING $query_string;
+ fastcgi_param REQUEST_METHOD $request_method;
+ fastcgi_param CONTENT_TYPE $content_type;
+ fastcgi_param CONTENT_LENGTH $content_length;
+
+ fastcgi_param PATH_INFO $fastcgi_script_name;
+ fastcgi_param SCRIPT_NAME $fastcgi_script_name;
+ fastcgi_param REQUEST_URI $request_uri;
+ fastcgi_param DOCUMENT_URI $document_uri;
+ fastcgi_param DOCUMENT_ROOT $document_root;
+ fastcgi_param SERVER_PROTOCOL $server_protocol;
+
+ fastcgi_param GATEWAY_INTERFACE CGI/1.1;
+ fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
+
+ fastcgi_param REMOTE_ADDR $remote_addr;
+ fastcgi_param REMOTE_PORT $remote_port;
+ fastcgi_param SERVER_ADDR $server_addr;
+ fastcgi_param SERVER_PORT $server_port;
+ fastcgi_param SERVER_NAME $server_name;
+
+ # Adjust the socket for your applications!
+ fastcgi_pass unix:$docroot/myapp.socket;
+ }
+ }
+
+It is the standard convention of nginx to include the fastcgi_params in a
+separate file (usually something like C</etc/nginx/fastcgi_params>) and
+simply include that file.
+
+=head3 Non-root configuration
+
+If you properly specify the PATH_INFO and SCRIPT_NAME parameters your
+application will be accessible at any path. The SCRIPT_NAME variable is the
+prefix of your application, and PATH_INFO would be everything in addition.
+
+As an example, if your application is rooted at /myapp, you would configure:
+
+ fastcgi_param PATH_INFO /myapp/;
+ fastcgi_param SCRIPT_NAME $fastcgi_script_name;
+
+C<$fastcgi_script_name> would be "/myapp/path/of/the/action". Catalyst will
+process this accordingly and setup the application base as expected.
+
+This behavior is somewhat different than Apache and Lighttpd, but is still
+functional.
+
+For more information on nginx, visit:
+L<http://nginx.net>
+
=head2 Microsoft IIS
It is possible to run Catalyst under IIS with FastCGI, but only on IIS 6.0
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP/Restarter (from rev 4483, trunk/Catalyst/lib/Catalyst/Engine/HTTP/Restarter)
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm
===================================================================
--- trunk/Catalyst/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm 2006-06-22 15:08:21 UTC (rev 4483)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,198 +0,0 @@
-package Catalyst::Engine::HTTP::Restarter::Watcher;
-
-use strict;
-use warnings;
-use base 'Class::Accessor::Fast';
-use File::Find;
-use File::Modified;
-use File::Spec;
-use Time::HiRes qw/sleep/;
-
-__PACKAGE__->mk_accessors(
- qw/delay
- directory
- modified
- regex
- watch_list/
-);
-
-sub new {
- my ( $class, %args ) = @_;
-
- my $self = {%args};
-
- bless $self, $class;
-
- $self->_init;
-
- return $self;
-}
-
-sub _init {
- my $self = shift;
-
- my $watch_list = $self->_index_directory;
- $self->watch_list($watch_list);
-
- $self->modified(
- File::Modified->new(
- method => 'mtime',
- files => [ keys %{$watch_list} ],
- )
- );
-}
-
-sub watch {
- my $self = shift;
-
- my @changes;
- my @changed_files;
-
- sleep $self->delay || 1;
-
- eval { @changes = $self->modified->changed };
- if ($@) {
-
- # File::Modified will die if a file is deleted.
- my ($deleted_file) = $@ =~ /stat '(.+)'/;
- push @changed_files, $deleted_file || 'unknown file';
- }
-
- if (@changes) {
-
- # update all mtime information
- $self->modified->update;
-
- # check if any files were changed
- @changed_files = grep { -f $_ } @changes;
-
- # Check if only directories were changed. This means
- # a new file was created.
- unless (@changed_files) {
-
- # re-index to find new files
- my $new_watch = $self->_index_directory;
-
- # look through the new list for new files
- my $old_watch = $self->watch_list;
- @changed_files = grep { !defined $old_watch->{$_} }
- keys %{$new_watch};
-
- return unless @changed_files;
- }
-
- # Test modified pm's
- for my $file (@changed_files) {
- next unless $file =~ /\.pm$/;
- if ( my $error = $self->_test($file) ) {
- print STDERR qq/File "$file" modified, not restarting\n\n/;
- print STDERR '*' x 80, "\n";
- print STDERR $error;
- print STDERR '*' x 80, "\n";
- return;
- }
- }
- }
-
- return @changed_files;
-}
-
-sub _index_directory {
- my $self = shift;
-
- my $dir = $self->directory || die "No directory specified";
- my $regex = $self->regex || '\.pm$';
- my %list;
-
- finddepth(
- {
- wanted => sub {
- my $file = File::Spec->rel2abs($File::Find::name);
- return unless $file =~ /$regex/;
- return unless -f $file;
- $file =~ s{/script/..}{};
- $list{$file} = 1;
-
- # also watch the directory for changes
- my $cur_dir = File::Spec->rel2abs($File::Find::dir);
- $cur_dir =~ s{/script/..}{};
- $list{$cur_dir} = 1;
- },
- no_chdir => 1
- },
- $dir
- );
- return \%list;
-}
-
-sub _test {
- my ( $self, $file ) = @_;
-
- delete $INC{$file};
- local $SIG{__WARN__} = sub { };
-
- open my $olderr, '>&STDERR';
- open STDERR, '>', File::Spec->devnull;
- eval "require '$file'";
- open STDERR, '>&', $olderr;
-
- return ($@) ? $@ : 0;
-}
-
-1;
-__END__
-
-=head1 NAME
-
-Catalyst::Engine::HTTP::Restarter::Watcher - Watch for changed application
-files
-
-=head1 SYNOPSIS
-
- my $watcher = Catalyst::Engine::HTTP::Restarter::Watcher->new(
- directory => '/path/to/MyApp',
- regex => '\.yml$|\.yaml$|\.pm$',
- delay => 1,
- );
-
- while (1) {
- my @changed_files = $watcher->watch();
- }
-
-=head1 DESCRIPTION
-
-This class monitors a directory of files for changes made to any file
-matching a regular expression. It correctly handles new files added to the
-application as well as files that are deleted.
-
-=head1 METHODS
-
-=head2 new ( directory => $path [, regex => $regex, delay => $delay ] )
-
-Creates a new Watcher object.
-
-=head2 watch
-
-Returns a list of files that have been added, deleted, or changed since the
-last time watch was called.
-
-=head1 SEE ALSO
-
-L<Catalyst>, L<Catalyst::Engine::HTTP::Restarter>, L<File::Modified>
-
-=head1 AUTHORS
-
-Sebastian Riedel, <sri at cpan.org>
-
-Andy Grundman, <andy at hybridized.org>
-
-=head1 THANKS
-
-Many parts are ripped out of C<HTTP::Server::Simple> by Jesse Vincent.
-
-=head1 COPYRIGHT
-
-This program is free software, you can redistribute it and/or modify it under
-the same terms as Perl itself.
-
-=cut
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm (from rev 4483, trunk/Catalyst/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP/Restarter/Watcher.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,204 @@
+package Catalyst::Engine::HTTP::Restarter::Watcher;
+
+use strict;
+use warnings;
+use base 'Class::Accessor::Fast';
+use File::Find;
+use File::Modified;
+use File::Spec;
+use Time::HiRes qw/sleep/;
+
+__PACKAGE__->mk_accessors(
+ qw/delay
+ directory
+ modified
+ regex
+ follow_symlinks
+ watch_list/
+);
+
+sub new {
+ my ( $class, %args ) = @_;
+
+ my $self = {%args};
+
+ bless $self, $class;
+
+ $self->_init;
+
+ return $self;
+}
+
+sub _init {
+ my $self = shift;
+
+ my $watch_list = $self->_index_directory;
+ $self->watch_list($watch_list);
+
+ $self->modified(
+ File::Modified->new(
+ method => 'mtime',
+ files => [ keys %{$watch_list} ],
+ )
+ );
+}
+
+sub watch {
+ my $self = shift;
+
+ my @changes;
+ my @changed_files;
+
+ my $delay = ( defined $self->delay ) ? $self->delay : 1;
+
+ sleep $delay if $delay > 0;
+
+ eval { @changes = $self->modified->changed };
+ if ($@) {
+
+ # File::Modified will die if a file is deleted.
+ my ($deleted_file) = $@ =~ /stat '(.+)'/;
+ push @changed_files, $deleted_file || 'unknown file';
+ }
+
+ if (@changes) {
+
+ # update all mtime information
+ $self->modified->update;
+
+ # check if any files were changed
+ @changed_files = grep { -f $_ } @changes;
+
+ # Check if only directories were changed. This means
+ # a new file was created.
+ unless (@changed_files) {
+
+ # re-index to find new files
+ my $new_watch = $self->_index_directory;
+
+ # look through the new list for new files
+ my $old_watch = $self->watch_list;
+ @changed_files = grep { !defined $old_watch->{$_} }
+ keys %{$new_watch};
+
+ return unless @changed_files;
+ }
+
+ # Test modified pm's
+ for my $file (@changed_files) {
+ next unless $file =~ /\.pm$/;
+ if ( my $error = $self->_test($file) ) {
+ print STDERR qq/File "$file" modified, not restarting\n\n/;
+ print STDERR '*' x 80, "\n";
+ print STDERR $error;
+ print STDERR '*' x 80, "\n";
+ return;
+ }
+ }
+ }
+
+ return @changed_files;
+}
+
+sub _index_directory {
+ my $self = shift;
+
+ my $dir = $self->directory;
+ die "No directory specified" if !$dir or ref($dir) && !@{$dir};
+
+ my $regex = $self->regex || '\.pm$';
+ my %list;
+
+ finddepth(
+ {
+ wanted => sub {
+ my $file = File::Spec->rel2abs($File::Find::name);
+ return unless $file =~ /$regex/;
+ return unless -f $file;
+ $file =~ s{/script/..}{};
+ $list{$file} = 1;
+
+ # also watch the directory for changes
+ my $cur_dir = File::Spec->rel2abs($File::Find::dir);
+ $cur_dir =~ s{/script/..}{};
+ $list{$cur_dir} = 1;
+ },
+ follow_fast => $self->follow_symlinks ? 1 : 0,
+ no_chdir => 1
+ },
+ ref $dir eq 'ARRAY' ? @{$dir} : $dir
+ );
+ return \%list;
+}
+
+sub _test {
+ my ( $self, $file ) = @_;
+
+ delete $INC{$file};
+ local $SIG{__WARN__} = sub { };
+
+ open my $olderr, '>&STDERR';
+ open STDERR, '>', File::Spec->devnull;
+ eval "require '$file'";
+ open STDERR, '>&', $olderr;
+
+ return ($@) ? $@ : 0;
+}
+
+1;
+__END__
+
+=head1 NAME
+
+Catalyst::Engine::HTTP::Restarter::Watcher - Watch for changed application
+files
+
+=head1 SYNOPSIS
+
+ my $watcher = Catalyst::Engine::HTTP::Restarter::Watcher->new(
+ directory => '/path/to/MyApp',
+ regex => '\.yml$|\.yaml$|\.pm$',
+ delay => 1,
+ );
+
+ while (1) {
+ my @changed_files = $watcher->watch();
+ }
+
+=head1 DESCRIPTION
+
+This class monitors a directory of files for changes made to any file
+matching a regular expression. It correctly handles new files added to the
+application as well as files that are deleted.
+
+=head1 METHODS
+
+=head2 new ( directory => $path [, regex => $regex, delay => $delay ] )
+
+Creates a new Watcher object.
+
+=head2 watch
+
+Returns a list of files that have been added, deleted, or changed since the
+last time watch was called.
+
+=head1 SEE ALSO
+
+L<Catalyst>, L<Catalyst::Engine::HTTP::Restarter>, L<File::Modified>
+
+=head1 AUTHORS
+
+Sebastian Riedel, <sri at cpan.org>
+
+Andy Grundman, <andy at hybridized.org>
+
+=head1 THANKS
+
+Many parts are ripped out of C<HTTP::Server::Simple> by Jesse Vincent.
+
+=head1 COPYRIGHT
+
+This program is free software, you can redistribute it and/or modify it under
+the same terms as Perl itself.
+
+=cut
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP/Restarter.pm (from rev 4483, trunk/Catalyst/lib/Catalyst/Engine/HTTP/Restarter.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP/Restarter.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP/Restarter.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,115 @@
+package Catalyst::Engine::HTTP::Restarter;
+
+use strict;
+use warnings;
+use base 'Catalyst::Engine::HTTP';
+use Catalyst::Engine::HTTP::Restarter::Watcher;
+use NEXT;
+
+sub run {
+ my ( $self, $class, $port, $host, $options ) = @_;
+
+ $options ||= {};
+
+ # Setup restarter
+ unless ( my $restarter = fork ) {
+
+ # Prepare
+ close STDIN;
+ close STDOUT;
+
+ my $watcher = Catalyst::Engine::HTTP::Restarter::Watcher->new(
+ directory => (
+ $options->{restart_directory} ||
+ File::Spec->catdir( $FindBin::Bin, '..' )
+ ),
+ follow_symlinks => $options->{follow_symlinks},
+ regex => $options->{restart_regex},
+ delay => $options->{restart_delay},
+ );
+
+ $host ||= '127.0.0.1';
+ while (1) {
+
+ # poll for changed files
+ my @changed_files = $watcher->watch();
+
+ # check if our parent process has died
+ exit if $^O ne 'MSWin32' and getppid == 1;
+
+ # Restart if any files have changed
+ if (@changed_files) {
+ my $files = join ', ', @changed_files;
+ print STDERR qq/File(s) "$files" modified, restarting\n\n/;
+
+ require IO::Socket::INET;
+ require HTTP::Headers;
+ require HTTP::Request;
+
+ my $client = IO::Socket::INET->new(
+ PeerAddr => $host,
+ PeerPort => $port
+ )
+ or die "Can't create client socket (is server running?): ",
+ $!;
+
+ # build the Kill request
+ my $req =
+ HTTP::Request->new( 'RESTART', '/',
+ HTTP::Headers->new( 'Connection' => 'close' ) );
+ $req->protocol('HTTP/1.0');
+
+ $client->send( $req->as_string )
+ or die "Can't send restart instruction: ", $!;
+ $client->close();
+ exit;
+ }
+ }
+ }
+
+ return $self->NEXT::run( $class, $port, $host, $options );
+}
+
+1;
+__END__
+
+=head1 NAME
+
+Catalyst::Engine::HTTP::Restarter - Catalyst Auto-Restarting HTTP Engine
+
+=head1 SYNOPSIS
+
+ script/myapp_server.pl -restart
+
+=head1 DESCRIPTION
+
+The Restarter engine will monitor files in your application for changes
+and restart the server when any changes are detected.
+
+=head1 METHODS
+
+=head2 run
+
+=head1 SEE ALSO
+
+L<Catalyst>, L<Catalyst::Engine::HTTP>, L<Catalyst::Engine::CGI>,
+L<Catalyst::Engine>.
+
+=head1 AUTHORS
+
+Sebastian Riedel, <sri at cpan.org>
+
+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.
+
+=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.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine/HTTP.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -12,10 +12,6 @@
use IO::Socket::INET ();
use IO::Select ();
-# For PAR
-require Catalyst::Engine::HTTP::Restarter;
-require Catalyst::Engine::HTTP::Restarter::Watcher;
-
use constant CHUNKSIZE => 64 * 1024;
use constant DEBUG => $ENV{CATALYST_HTTP_DEBUG} || 0;
@@ -159,7 +155,7 @@
# Prepend the headers if they have not yet been sent
if ( $self->_has_header_buf ) {
$self->_warn_on_write_error(
- $self->$orig($self->_clear_header_buf)
+ $self->$orig($c, $self->_clear_header_buf)
);
}
@@ -368,6 +364,9 @@
while (1) {
my ( $path, $query_string ) = split /\?/, $uri, 2;
+ # URI is not the same as path. Remove scheme, domain name and port from it
+ $path =~ s{^https?://[^/?#]+}{};
+
# Initialize CGI environment
local %ENV = (
PATH_INFO => $path || '',
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Engine.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -48,10 +48,12 @@
my $body = $c->response->body;
no warnings 'uninitialized';
if ( blessed($body) && $body->can('read') or ref($body) eq 'GLOB' ) {
- while ( !eof $body ) {
- read $body, my ($buffer), $CHUNKSIZE;
- last unless $self->write( $c, $buffer );
- }
+ my $got;
+ do {
+ $got = read $body, my ($buffer), $CHUNKSIZE;
+ $got = 0 unless $self->write( $c, $buffer );
+ } while $got > 0;
+
close $body;
}
else {
@@ -110,7 +112,7 @@
my ( $self, $c ) = @_;
$c->res->content_type('text/html; charset=utf-8');
- my $name = $c->config->{name} || join(' ', split('::', ref $c));
+ my $name = ref($c)->config->{name} || join(' ', split('::', ref $c));
my ( $title, $error, $infos );
if ( $c->debug ) {
@@ -315,13 +317,14 @@
sub prepare_body {
my ( $self, $c ) = @_;
+ my $appclass = ref($c) || $c;
if ( my $length = $self->read_length ) {
my $request = $c->request;
unless ( $request->_body ) {
my $type = $request->header('Content-Type');
$request->_body(HTTP::Body->new( $type, $length ));
- $request->_body->tmpdir( $c->config->{uploadtmp} )
- if exists $c->config->{uploadtmp};
+ $request->_body->tmpdir( $appclass->config->{uploadtmp} )
+ if exists $appclass->config->{uploadtmp};
}
while ( my $buffer = $self->read($c) ) {
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception/Basic.pm (from rev 12002, Catalyst-Runtime/5.80/trunk/lib/Catalyst/Exception/Basic.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception/Basic.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception/Basic.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,107 @@
+package Catalyst::Exception::Basic;
+
+use MooseX::Role::WithOverloading;
+use Carp;
+use namespace::clean -except => 'meta';
+
+with 'Catalyst::Exception::Interface';
+
+has message => (
+ is => 'ro',
+ isa => 'Str',
+ default => sub { $! || '' },
+);
+
+sub as_string {
+ my ($self) = @_;
+ return $self->message;
+}
+
+around BUILDARGS => sub {
+ my ($next, $class, @args) = @_;
+ if (@args == 1 && !ref $args[0]) {
+ @args = (message => $args[0]);
+ }
+
+ my $args = $class->$next(@args);
+ $args->{message} ||= $args->{error}
+ if exists $args->{error};
+
+ return $args;
+};
+
+sub throw {
+ my $class = shift;
+ my $error = $class->new(@_);
+ local $Carp::CarpLevel = 1;
+ croak $error;
+}
+
+sub rethrow {
+ my ($self) = @_;
+ croak $self;
+}
+
+1;
+
+=head1 NAME
+
+Catalyst::Exception::Basic - Basic Catalyst Exception Role
+
+=head1 SYNOPSIS
+
+ package My::Exception;
+ use Moose;
+ use namespace::clean -except => 'meta';
+
+ with 'Catalyst::Exception::Basic';
+
+ # Elsewhere..
+ My::Exception->throw( qq/Fatal exception/ );
+
+See also L<Catalyst> and L<Catalyst::Exception>.
+
+=head1 DESCRIPTION
+
+This is the basic Catalyst Exception role which implements all of
+L<Catalyst::Exception::Interface>.
+
+=head1 ATTRIBUTES
+
+=head2 message
+
+Holds the exception message.
+
+=head1 METHODS
+
+=head2 as_string
+
+Stringifies the exception's message attribute.
+Called when the object is stringified by overloading.
+
+=head2 throw( $message )
+
+=head2 throw( message => $message )
+
+=head2 throw( error => $error )
+
+Throws a fatal exception.
+
+=head2 rethrow( $exception )
+
+Rethrows a caught exception.
+
+=head2 meta
+
+Provided by Moose
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception/Detach.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception/Detach.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception/Detach.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -3,7 +3,7 @@
use Moose;
use namespace::clean -except => 'meta';
-extends 'Catalyst::Exception';
+with 'Catalyst::Exception::Basic';
has '+message' => (
default => "catalyst_detach\n",
@@ -19,4 +19,34 @@
Catalyst::Exception::Detach - Exception for redispatching using $ctx->detach()
+=head1 DESCRIPTION
+
+This is the class for the Catalyst Exception which is thrown then you call
+C<< $c->detach() >>.
+
+This class is not intended to be used directly by users.
+
+=head2 meta
+
+Provided by Moose
+
+=head1 SEE ALSO
+
+=over 4
+
+=item L<Catalyst>
+
+=item L<Catalyst::Exception>
+
+=back
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
=cut
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception/Go.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception/Go.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception/Go.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -3,7 +3,7 @@
use Moose;
use namespace::clean -except => 'meta';
-extends 'Catalyst::Exception';
+with 'Catalyst::Exception::Basic';
has '+message' => (
default => "catalyst_go\n",
@@ -19,4 +19,34 @@
Catalyst::Exception::Go - Exception for redispatching using $ctx->go()
+=head1 DESCRIPTION
+
+This is the class for the Catalyst Exception which is thrown then you call
+C<< $c->go() >>.
+
+This class is not intended to be used directly by users.
+
+=head2 meta
+
+Provided by Moose
+
+=head1 SEE ALSO
+
+=over 4
+
+=item L<Catalyst>
+
+=item L<Catalyst::Exception>
+
+=back
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
=cut
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception/Interface.pm (from rev 12002, Catalyst-Runtime/5.80/trunk/lib/Catalyst/Exception/Interface.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception/Interface.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception/Interface.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,77 @@
+package Catalyst::Exception::Interface;
+
+use MooseX::Role::WithOverloading;
+use namespace::clean -except => 'meta';
+
+use overload
+ q{""} => sub { $_[0]->as_string },
+ fallback => 1;
+
+requires qw/as_string throw rethrow/;
+
+1;
+
+__END__
+
+=head1 NAME
+
+Catalyst::Exception::Interface - Role defining the interface for Catalyst exceptions
+
+=head1 SYNOPSIS
+
+ package My::Catalyst::Like::Exception;
+ use Moose;
+ use namespace::clean -except => 'meta';
+
+ with 'Catalyst::Exception::Interface';
+
+ # This comprises the required interface.
+ sub as_string { 'the exception text for stringification' }
+ sub die { shift; die @_ }
+ sub die { shift; die @_ }
+
+=head1 DESCRIPTION
+
+This is a role for the required interface for Catalyst exceptions.
+
+It ensures that all exceptions follow the expected interface,
+and adds overloading for stringification when composed onto a
+class.
+
+Note that if you compose this role onto another role, that role
+must use L<MooseX::Role::WithOverloading>.
+
+=head1 REQUIRED METHODS
+
+=head2 as_string
+
+=head2 throw
+
+=head2 rethrow
+
+=head1 METHODS
+
+=head2 meta
+
+Provided by Moose
+
+=head1 SEE ALSO
+
+=over 4
+
+=item L<Catalyst>
+
+=item L<Catalyst::Exception>
+
+=back
+
+=head1 AUTHORS
+
+Catalyst Contributors, see Catalyst.pm
+
+=head1 COPYRIGHT
+
+This library is free software. You can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Exception.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -2,12 +2,6 @@
# XXX: See bottom of file for Exception implementation
-package Catalyst::Exception::Base;
-
-use Moose;
-use Carp;
-use namespace::clean -except => 'meta';
-
=head1 NAME
Catalyst::Exception - Catalyst Exception Class
@@ -32,48 +26,6 @@
Throws a fatal exception.
-=cut
-
-has message => (
- is => 'ro',
- isa => 'Str',
- default => sub { $! || '' },
-);
-
-use overload
- q{""} => \&as_string,
- fallback => 1;
-
-sub as_string {
- my ($self) = @_;
- return $self->message;
-}
-
-around BUILDARGS => sub {
- my ($next, $class, @args) = @_;
- if (@args == 1 && !ref $args[0]) {
- @args = (message => $args[0]);
- }
-
- my $args = $class->$next(@args);
- $args->{message} ||= $args->{error}
- if exists $args->{error};
-
- return $args;
-};
-
-sub throw {
- my $class = shift;
- my $error = $class->new(@_);
- local $Carp::CarpLevel = 1;
- croak $error;
-}
-
-sub rethrow {
- my ($self) = @_;
- croak $self;
-}
-
=head2 meta
Provided by Moose
@@ -89,19 +41,30 @@
=cut
-Catalyst::Exception::Base->meta->make_immutable;
+{
+ package Catalyst::Exception::Base;
-package Catalyst::Exception;
+ use Moose;
+ use namespace::clean -except => 'meta';
-use Moose;
-use namespace::clean -except => 'meta';
+ with 'Catalyst::Exception::Basic';
-use vars qw[$CATALYST_EXCEPTION_CLASS];
-
-BEGIN {
- extends($CATALYST_EXCEPTION_CLASS || 'Catalyst::Exception::Base');
+ __PACKAGE__->meta->make_immutable;
}
-__PACKAGE__->meta->make_immutable;
+{
+ package Catalyst::Exception;
+ use Moose;
+ use namespace::clean -except => 'meta';
+
+ use vars qw[$CATALYST_EXCEPTION_CLASS];
+
+ BEGIN {
+ extends($CATALYST_EXCEPTION_CLASS || 'Catalyst::Exception::Base');
+ }
+
+ __PACKAGE__->meta->make_immutable;
+}
+
1;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual (from rev 6895, trunk/Catalyst-Runtime/lib/Catalyst/Manual)
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation (from rev 6895, trunk/Catalyst-Runtime/lib/Catalyst/Manual/Installation)
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation/CentOS4.pod
===================================================================
--- trunk/Catalyst-Runtime/lib/Catalyst/Manual/Installation/CentOS4.pod 2007-09-14 17:10:31 UTC (rev 6895)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation/CentOS4.pod 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,377 +0,0 @@
-=head1 NAME
-
-Catalyst::Manual::Installation::CentOS4 - Catalyst Installation on CentOS 4
-
-
-
-=head1 DESCRIPTION
-
-This document provides directions on how to install CentOS 4 (a rebuild
-of RedHat Enterprise 4) and then install Catalyst.
-
-If you already have a functioning install of CentOS, RHEL, or a
-comparable Linux OS, you should be able to skip this first section and
-go straight to the C<INSTALL CATALYST> section.
-
-B<NOTE:> You might want to consult the latest version of this document. It
-is available at:
-L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Installation/CentOS4.pod>
-
-
-
-=head1 INSTALL CENTOS
-
-These directions are written for CentOS 4.4 on an i386 machine; however,
-you can substitute other versions as they become available.
-
-
-=over 4
-
-=item *
-
-Go to L<http://isoredirect.centos.org/centos/4/isos/i386/> and click the
-nearest mirror.
-
-=item *
-
-Download C<CentOS-4.4-i386-bin1of4.iso> (you only need the first disk).
-
-=item *
-
-Burn the .iso to CD.
-
-=item *
-
-Insert the CD into your machine and power it up.
-
-=item *
-
-Hit C<Enter> at the C<boot:> prompt.
-
-=item *
-
-CD media test: you can either select C<OK> or C<Skip> depending on
-whether or not you trust your burn.
-
-=item *
-
-The installation GUI should start. Click next at the "Welcome to
-CentOS-4" screen.
-
-=item *
-
-Select a language and click C<Next>.
-
-=item *
-
-Select a keyboard configuration and click C<Next>.
-
-=item *
-
-Select C<Custom> for the installation type and click C<Next>.
-
-=item *
-
-Leave C<Automatically partition> selected on the C<Disk Partitioning
-Setup> and click C<Next>.
-
-=item *
-
-Uncheck C<Review (and modify if needed) the partitions created>, but
-leave the rest of the default settings on the C<Automatic Partitioning>
-screen. Then click C<Next>.
-
-=item *
-
-Click C<Yes> at the C<Are you sure you want to do this?> warning.
-
-=item *
-
-Click C<Next> on the C<Boot Loader Configuration> screen.
-
-=item *
-
-Update the C<Network Configuration> screen as necessary and click C<Next>.
-
-=item *
-
-Check C<Remote Login (SSH)> and click C<Next> on the C<Firewall
-Configuration> screen.
-
-=item *
-
-Select additional languages as necessary. Click C<Next>.
-
-=item *
-
-Select the appropriate time zone and click C<Next>.
-
-=item *
-
-Enter a root password and click C<Next>.
-
-=item *
-
-Scroll to the bottom of the C<Package Group Selection> screen and check
-C<Minimal> (the last option). Click C<Next>.
-
-=item *
-
-Click C<Next> at the C<About to Install> screen.
-
-=item *
-
-The installation will prepare the hard drive and then install the
-required rpm packages.
-
-=item *
-
-Once the installation completes, remove the CD and click C<Reboot>.
-
-=item *
-
-Type C<vi /etc/sysconfig/iptables> and add the following line as the
-third to last line of the file (I<above> the C<-A RH-Firewall-1-INPUT -j
-REJECT --reject-with icmp-host-prohibited> line):
-
- -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3000 -j ACCEPT
-
-This will allow Catalyst to make use of port 3000 (the default for the
-development server).
-
-Type C<service iptables restart> to restart the iptables firewall using
-the updated configuration.
-
-=item *
-
-Type C<yum -y update> to retrieve the latest patches.
-
-=back
-
-
-=head1 INSTALL CATALYST
-
-=over 4
-
-=item *
-
-Type C<yum -y install gcc expat-devel sqlite3> to install several
-packages used by Catalyst.
-
-=item *
-
-Type the following:
-
- $ perl -MCPAN -e shell
-
- ...
-
- Are you ready for manual configuration? [yes] yes
- The following questions are intended to help you with the
-
- ...
-
- cpan shell -- CPAN exploration and modules installation (v1.7601)
- ReadLine support available (try 'install Bundle::CPAN')
-
- cpan> force install Module::Build
-
- ...
-
- cpan> quit
-
-=item *
-
-B<Note:> You need to have CPAN manually configured prior to running
-cat-install. As shown above, you should automatically receive
-a prompt for this when you first run C<perl -MCPAN -e shell>. You
-can re-run the configuration script by typing C<o conf init> at the
-C<cpanE<gt>> prompt.
-
-B<Optional:> The remaining steps of the installation could run
-significantly faster if you configure a fast mirror that uses HTTP vs.
-FTP (both transfer data at the same rate once the transfer is in
-progress, but HTTP connects much more quickly... and a Catalyst
-installation involves many connections). If you want to change the
-selection(s) you made during the "manual configuration" process above,
-you can manually add a single URL. To prepend a new URL to the B<front>
-of the list, use the C<unshift> option to C<o conf>:
-
- cpan> o conf urllist unshift http://www.perl.com/CPAN/
-
-Where C<http://www.perl.com/CPAN/> is replaced by a nearby, HTTP-based
-mirror. You can get a list of all mirrors (including where they are
-located, their bandwidth, and their update frequency) at
-L<http://www.perl.com/CPAN/MIRRORED.BY>.
-
-Then, be sure to save your changes (or they will be lost the next
-time you restart the CPAN shell):
-
- cpan> o conf commit
-
-You can view the current settings with C<o conf urllist> (or just
-C<o conf> to view all settings):
-
- cpan> o conf urllist
- urllist
- http://www.perl.com/CPAN/
- Type 'o conf' to view configuration edit options
-
-Note that multiple values can be entered for the C<urllist> option (the
-first entry will be used as long as it responds).
-
-=item *
-
-Review the C<cat-install> documentation from the
-L<http://www.shadowcatsystems.co.uk> web site:
-
- If you want to get started quickly with Catalyst, Shadowcat provides an
- installer script that will automate most of the process of installing it
- for you. Please bear in mind that this script is currently considered
- beta quality; we don't think it will eat your system but we make no
- guarantee of that.
-
- First, you'll need -
-
- * Perl, 5.8.1+ (if you're on windows, get it from Active State)
- * make of some sort. On unix/linux you should already have one. On
- windows get nmake from Microsoft.
- * A compiler. On unix/linux you should already have one. On windows,
- get the latest Dev-C++ beta.
- * All three of the above in your PATH for whatever shell you're using
- * A configured CPAN.pm. perl -MCPAN -e shell should get CPAN to walk
- you through the configuration process
- * Module::Build. Active State kindly include this for you.
-
- Ok, now that your environment is set up, download the installer from
- this link, open a command prompt in the directory you downloaded it to
- and run perl cat-install. By the time it exits, you should have a full
- Catalyst install.
-
- If anything goes wrong, please send the full build log and the output of
- perl -V to cat-install (at) shadowcatsystems.co.uk so we can try and
- resolve your issue.
-
-
-=item *
-
-Type C<wget http://www.shadowcatsystems.co.uk/static/cat-install> to
-retrieve a copy of the C<cat-install> script.
-
-=item *
-
-Type C<vi cat-install> to open the installer script, then insert the
-following lines at the bottom of the file (after the
-C<install('Catalyst');> line):
-
- install('ExtUtils::ParseXS');
- install('Digest::SHA1');
- install('Digest::SHA');
- install('DBIx::Class');
- install('DBIx::Class::HTMLWidget');
- install('Module::ScanDeps');
- install('Module::CoreList');
- install('PAR::Dist');
- install('Archive::Tar');
- install('Module::Install');
- install('Catalyst::Devel');
- install('Catalyst::Plugin::ConfigLoader');
- install('Catalyst::Plugin::Session');
- install('Catalyst::Plugin::Session::State::Cookie');
- install('Catalyst::Plugin::Session::Store::FastMmap');
- install('Catalyst::Plugin::Authorization::ACL');
- install('Catalyst::Plugin::Authentication');
- install('Catalyst::Plugin::Authorization::Roles');
- install('Catalyst::Plugin::Authentication::Store::DBIC');
- install('Catalyst::Plugin::DefaultEnd');
- install('Catalyst::Plugin::StackTrace');
- install('Catalyst::Plugin::Dumper');
- install('Catalyst::Plugin::HTML::Widget');
- install('Catalyst::Model::DBIC::Schema');
- install('Catalyst::View::TT');
- install('Test::WWW::Mechanize');
- install('Test::WWW::Mechanize::Catalyst');
- install('Test::Pod');
- install('Test::Pod::Coverage');
-
-=item *
-
-Type C<perl cat-install>. It will take a while to complete.
-
-Tip: You may want to enable logging of the output that C<cat-install>
-generates as it runs -- it can be useful if you need to troubleshoot
-a failure. The log will generate almost 1 MB of output.
-
-Note: Once the C<perl cat-install> is complete, you may want to rerun the
-command to check the status of the packages listed in <cat-install>. Ideally,
-everything should return a I<name> C<is up to date> message. If any packages
-try to re-install, the you could need to manually install the package with the
-C<force> option. Also, look for new optional dependences that C<cat-install>
-was not able to automatically handle. You can address these by manually
-installing the dependency and then re-running C<perl cat-install>.
-
-In some cases you may wish to install an earlier version of a module. For
-example, say that the latest version of Module::Install is 0.64 and you
-want to install 0.63. The following command under C<perl -MCPAN -e shell>:
-
- cpan> install A/AD/ADAMK/Module-Install-0.63.tar.gz
-
-=back
-
-You should now have a functioning Catalyst installation with the modules
-and plugins required to run the Catalyst tutorial.
-
-
-=head1 TESTING THE INSTALLATION
-
-=over 4
-
-=item *
-
-Download the tarball of the final tutorial application:
-
- $ wget http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Tutorial/Final_Tarball/MyApp.tgz
-
-=item *
-
-Untar it:
-
- $ tar zxvf MyApp.tgz
- $ cd MyApp
-
-=item *
-
-Run the tests:
-
- $ CATALYST_DEBUG=0 prove --lib lib t
- t/02pod...............skipped
- all skipped: set TEST_POD to enable this test
- t/03podcoverage.......skipped
- all skipped: set TEST_POD to enable this test
- t/01app...............ok
- t/controller_Login....ok
- t/live_app01..........ok 1/0[debug] ***Root::auto User not found, forwarding to /login
- t/live_app01..........ok 2/0[debug] ***Root::auto User not found, forwarding to /login
- t/live_app01..........ok 15/0[debug] ***Root::auto User not found, forwarding to /login
- t/live_app01..........ok 16/0[debug] ***Root::auto User not found, forwarding to /login
- t/live_app01..........ok
- t/model_MyAppDB.......ok
- All tests successful, 2 tests skipped.
- Files=6, Tests=55, 11 wallclock secs ( 4.68 cusr + 4.84 csys = 9.52 CPU)
-
-You should see C<All tests successful>.
-
-=back
-
-
-
-=head1 AUTHOR
-
-Kennedy Clark, C<hkclark at gmail.com>
-
-Please report any errors, issues or suggestions to the author. The
-most recent version of the Catalyst Tutorial can be found at
-L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
-
-Copyright 2006, Kennedy Clark, under Creative Commons License
-(L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation/CentOS4.pod (from rev 6895, trunk/Catalyst-Runtime/lib/Catalyst/Manual/Installation/CentOS4.pod)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation/CentOS4.pod (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation/CentOS4.pod 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,377 @@
+=head1 NAME
+
+Catalyst::Manual::Installation::CentOS4 - Catalyst Installation on CentOS 4
+
+
+
+=head1 DESCRIPTION
+
+This document provides directions on how to install CentOS 4 (a rebuild
+of RedHat Enterprise 4) and then install Catalyst.
+
+If you already have a functioning install of CentOS, RHEL, or a
+comparable Linux OS, you should be able to skip this first section and
+go straight to the C<INSTALL CATALYST> section.
+
+B<NOTE:> You might want to consult the latest version of this document. It
+is available at:
+L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Installation/CentOS4.pod>
+
+
+
+=head1 INSTALL CENTOS
+
+These directions are written for CentOS 4.4 on an i386 machine; however,
+you can substitute other versions as they become available.
+
+
+=over 4
+
+=item *
+
+Go to L<http://isoredirect.centos.org/centos/4/isos/i386/> and click the
+nearest mirror.
+
+=item *
+
+Download C<CentOS-4.4-i386-bin1of4.iso> (you only need the first disk).
+
+=item *
+
+Burn the .iso to CD.
+
+=item *
+
+Insert the CD into your machine and power it up.
+
+=item *
+
+Hit C<Enter> at the C<boot:> prompt.
+
+=item *
+
+CD media test: you can either select C<OK> or C<Skip> depending on
+whether or not you trust your burn.
+
+=item *
+
+The installation GUI should start. Click next at the "Welcome to
+CentOS-4" screen.
+
+=item *
+
+Select a language and click C<Next>.
+
+=item *
+
+Select a keyboard configuration and click C<Next>.
+
+=item *
+
+Select C<Custom> for the installation type and click C<Next>.
+
+=item *
+
+Leave C<Automatically partition> selected on the C<Disk Partitioning
+Setup> and click C<Next>.
+
+=item *
+
+Uncheck C<Review (and modify if needed) the partitions created>, but
+leave the rest of the default settings on the C<Automatic Partitioning>
+screen. Then click C<Next>.
+
+=item *
+
+Click C<Yes> at the C<Are you sure you want to do this?> warning.
+
+=item *
+
+Click C<Next> on the C<Boot Loader Configuration> screen.
+
+=item *
+
+Update the C<Network Configuration> screen as necessary and click C<Next>.
+
+=item *
+
+Check C<Remote Login (SSH)> and click C<Next> on the C<Firewall
+Configuration> screen.
+
+=item *
+
+Select additional languages as necessary. Click C<Next>.
+
+=item *
+
+Select the appropriate time zone and click C<Next>.
+
+=item *
+
+Enter a root password and click C<Next>.
+
+=item *
+
+Scroll to the bottom of the C<Package Group Selection> screen and check
+C<Minimal> (the last option). Click C<Next>.
+
+=item *
+
+Click C<Next> at the C<About to Install> screen.
+
+=item *
+
+The installation will prepare the hard drive and then install the
+required rpm packages.
+
+=item *
+
+Once the installation completes, remove the CD and click C<Reboot>.
+
+=item *
+
+Type C<vi /etc/sysconfig/iptables> and add the following line as the
+third to last line of the file (I<above> the C<-A RH-Firewall-1-INPUT -j
+REJECT --reject-with icmp-host-prohibited> line):
+
+ -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3000 -j ACCEPT
+
+This will allow Catalyst to make use of port 3000 (the default for the
+development server).
+
+Type C<service iptables restart> to restart the iptables firewall using
+the updated configuration.
+
+=item *
+
+Type C<yum -y update> to retrieve the latest patches.
+
+=back
+
+
+=head1 INSTALL CATALYST
+
+=over 4
+
+=item *
+
+Type C<yum -y install gcc expat-devel sqlite3> to install several
+packages used by Catalyst.
+
+=item *
+
+Type the following:
+
+ $ perl -MCPAN -e shell
+
+ ...
+
+ Are you ready for manual configuration? [yes] yes
+ The following questions are intended to help you with the
+
+ ...
+
+ cpan shell -- CPAN exploration and modules installation (v1.7601)
+ ReadLine support available (try 'install Bundle::CPAN')
+
+ cpan> force install Module::Build
+
+ ...
+
+ cpan> quit
+
+=item *
+
+B<Note:> You need to have CPAN manually configured prior to running
+cat-install. As shown above, you should automatically receive
+a prompt for this when you first run C<perl -MCPAN -e shell>. You
+can re-run the configuration script by typing C<o conf init> at the
+C<cpanE<gt>> prompt.
+
+B<Optional:> The remaining steps of the installation could run
+significantly faster if you configure a fast mirror that uses HTTP vs.
+FTP (both transfer data at the same rate once the transfer is in
+progress, but HTTP connects much more quickly... and a Catalyst
+installation involves many connections). If you want to change the
+selection(s) you made during the "manual configuration" process above,
+you can manually add a single URL. To prepend a new URL to the B<front>
+of the list, use the C<unshift> option to C<o conf>:
+
+ cpan> o conf urllist unshift http://www.perl.com/CPAN/
+
+Where C<http://www.perl.com/CPAN/> is replaced by a nearby, HTTP-based
+mirror. You can get a list of all mirrors (including where they are
+located, their bandwidth, and their update frequency) at
+L<http://www.perl.com/CPAN/MIRRORED.BY>.
+
+Then, be sure to save your changes (or they will be lost the next
+time you restart the CPAN shell):
+
+ cpan> o conf commit
+
+You can view the current settings with C<o conf urllist> (or just
+C<o conf> to view all settings):
+
+ cpan> o conf urllist
+ urllist
+ http://www.perl.com/CPAN/
+ Type 'o conf' to view configuration edit options
+
+Note that multiple values can be entered for the C<urllist> option (the
+first entry will be used as long as it responds).
+
+=item *
+
+Review the C<cat-install> documentation from the
+L<http://www.shadowcatsystems.co.uk> web site:
+
+ If you want to get started quickly with Catalyst, Shadowcat provides an
+ installer script that will automate most of the process of installing it
+ for you. Please bear in mind that this script is currently considered
+ beta quality; we don't think it will eat your system but we make no
+ guarantee of that.
+
+ First, you'll need -
+
+ * Perl, 5.8.1+ (if you're on windows, get it from Active State)
+ * make of some sort. On unix/linux you should already have one. On
+ windows get nmake from Microsoft.
+ * A compiler. On unix/linux you should already have one. On windows,
+ get the latest Dev-C++ beta.
+ * All three of the above in your PATH for whatever shell you're using
+ * A configured CPAN.pm. perl -MCPAN -e shell should get CPAN to walk
+ you through the configuration process
+ * Module::Build. Active State kindly include this for you.
+
+ Ok, now that your environment is set up, download the installer from
+ this link, open a command prompt in the directory you downloaded it to
+ and run perl cat-install. By the time it exits, you should have a full
+ Catalyst install.
+
+ If anything goes wrong, please send the full build log and the output of
+ perl -V to cat-install (at) shadowcatsystems.co.uk so we can try and
+ resolve your issue.
+
+
+=item *
+
+Type C<wget http://www.shadowcatsystems.co.uk/static/cat-install> to
+retrieve a copy of the C<cat-install> script.
+
+=item *
+
+Type C<vi cat-install> to open the installer script, then insert the
+following lines at the bottom of the file (after the
+C<install('Catalyst');> line):
+
+ install('ExtUtils::ParseXS');
+ install('Digest::SHA1');
+ install('Digest::SHA');
+ install('DBIx::Class');
+ install('DBIx::Class::HTMLWidget');
+ install('Module::ScanDeps');
+ install('Module::CoreList');
+ install('PAR::Dist');
+ install('Archive::Tar');
+ install('Module::Install');
+ install('Catalyst::Devel');
+ install('Catalyst::Plugin::ConfigLoader');
+ install('Catalyst::Plugin::Session');
+ install('Catalyst::Plugin::Session::State::Cookie');
+ install('Catalyst::Plugin::Session::Store::FastMmap');
+ install('Catalyst::Plugin::Authorization::ACL');
+ install('Catalyst::Plugin::Authentication');
+ install('Catalyst::Plugin::Authorization::Roles');
+ install('Catalyst::Plugin::Authentication::Store::DBIC');
+ install('Catalyst::Plugin::DefaultEnd');
+ install('Catalyst::Plugin::StackTrace');
+ install('Catalyst::Plugin::Dumper');
+ install('Catalyst::Plugin::HTML::Widget');
+ install('Catalyst::Model::DBIC::Schema');
+ install('Catalyst::View::TT');
+ install('Test::WWW::Mechanize');
+ install('Test::WWW::Mechanize::Catalyst');
+ install('Test::Pod');
+ install('Test::Pod::Coverage');
+
+=item *
+
+Type C<perl cat-install>. It will take a while to complete.
+
+Tip: You may want to enable logging of the output that C<cat-install>
+generates as it runs -- it can be useful if you need to troubleshoot
+a failure. The log will generate almost 1 MB of output.
+
+Note: Once the C<perl cat-install> is complete, you may want to rerun the
+command to check the status of the packages listed in <cat-install>. Ideally,
+everything should return a I<name> C<is up to date> message. If any packages
+try to re-install, the you could need to manually install the package with the
+C<force> option. Also, look for new optional dependences that C<cat-install>
+was not able to automatically handle. You can address these by manually
+installing the dependency and then re-running C<perl cat-install>.
+
+In some cases you may wish to install an earlier version of a module. For
+example, say that the latest version of Module::Install is 0.64 and you
+want to install 0.63. The following command under C<perl -MCPAN -e shell>:
+
+ cpan> install A/AD/ADAMK/Module-Install-0.63.tar.gz
+
+=back
+
+You should now have a functioning Catalyst installation with the modules
+and plugins required to run the Catalyst tutorial.
+
+
+=head1 TESTING THE INSTALLATION
+
+=over 4
+
+=item *
+
+Download the tarball of the final tutorial application:
+
+ $ wget http://dev.catalyst.perl.org/repos/Catalyst/trunk/examples/Tutorial/Final_Tarball/MyApp.tgz
+
+=item *
+
+Untar it:
+
+ $ tar zxvf MyApp.tgz
+ $ cd MyApp
+
+=item *
+
+Run the tests:
+
+ $ CATALYST_DEBUG=0 prove --lib lib t
+ t/02pod...............skipped
+ all skipped: set TEST_POD to enable this test
+ t/03podcoverage.......skipped
+ all skipped: set TEST_POD to enable this test
+ t/01app...............ok
+ t/controller_Login....ok
+ t/live_app01..........ok 1/0[debug] ***Root::auto User not found, forwarding to /login
+ t/live_app01..........ok 2/0[debug] ***Root::auto User not found, forwarding to /login
+ t/live_app01..........ok 15/0[debug] ***Root::auto User not found, forwarding to /login
+ t/live_app01..........ok 16/0[debug] ***Root::auto User not found, forwarding to /login
+ t/live_app01..........ok
+ t/model_MyAppDB.......ok
+ All tests successful, 2 tests skipped.
+ Files=6, Tests=55, 11 wallclock secs ( 4.68 cusr + 4.84 csys = 9.52 CPU)
+
+You should see C<All tests successful>.
+
+=back
+
+
+
+=head1 AUTHOR
+
+Kennedy Clark, C<hkclark at gmail.com>
+
+Please report any errors, issues or suggestions to the author. The
+most recent version of the Catalyst Tutorial can be found at
+L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/>.
+
+Copyright 2006, Kennedy Clark, under Creative Commons License
+(L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation.pod
===================================================================
--- trunk/Catalyst-Runtime/lib/Catalyst/Manual/Installation.pod 2007-09-14 17:10:31 UTC (rev 6895)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation.pod 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,152 +0,0 @@
-=head1 NAME
-
-Catalyst::Manual::Installation - Catalyst Installation
-
-=head1 DESCRIPTION
-
-How to install Catalyst.
-
-=head1 INSTALLATION
-
-One of the frequent problems reported by new users of Catalyst is that
-it can be extremely time-consuming and difficult to install.
-
-One of the great strengths of Perl as a programming language is its use
-of CPAN, the Comprehensive Perl Archive Network, an enormous global
-repository containing over 10,000 free modules. For almost any basic
-task--and a very large number of non-basic ones--there is a module on
-CPAN that will help you. Catalyst has taken advantage of this, and uses
-a very large number of CPAN modules, rather than reinventing the wheel
-over and over again. On the one hand, Catalyst gains power and
-flexibility through this re-use of existing code. On the other hand,
-Catalyst's reliance on CPAN can complicate initial installations,
-especially in shared-hosting environments where you, the user, do not
-have easy control over what versions of other modules are installed.
-
-It is worth stressing that the difficulties found in installing Catalyst
-are caused not by anything intrinsic to Catalyst itself, but rather by
-the interrelated dependencies of a large number of required modules.
-
-Fortunately, there are a growing number of methods that can dramatically
-ease this undertaking. Note that for many of these, you will probably
-need to install additional Catalyst-related modules (especially plugins)
-to do the things you want. As of version 5.70, Catalyst has split into
-two packages, L<Catalyst::Runtime>, which includes the core elements
-necessary to deploy a Catalyst application, and L<Catalyst::Devel>,
-which includes the Helpers and other things necessary or useful for
-developing Catalyst applications. In a purely deployment environment
-you can omit L<Catalyst::Devel>.
-
-=over 4
-
-=item *
-
-Matt Trout's C<cat-install> script
-
-Available at L<http://www.shadowcatsystems.co.uk/static/cat-install>,
-C<cat-install> can be a quick and painless way to get Catalyst up and
-running on your system. Just download the script from the link above
-and type C<perl cat-install>. This script automates the process of
-installing Catalyst itself and its dependencies, with bits of overriding
-so that the process does not require user interaction. C<cat-install>
-installs Catalyst and its dependencies using the L<CPAN> module, so that
-modules are installed the same way you would probably install them
-normally--it just makes it easier. This is a recommended solution for
-installation.
-
-=item *
-
-Chris Laco's CatInABox
-
-CatInABox is a complete version of Catalyst that is installed locally on
-your system, so that you don't need to go through the effort of doing a
-full install. Simply download the tarball from
-L<http://handelframework.com/downloads/CatInABox.tar.gz> and unpack it
-on your machine. Depending on your OS platform, either run C<start.bat>
-or C<start.sh> to set your bin/PERLLIB paths. This tarball contains
-everything needed to try out Catalyst including Catalyst itself,
-Template Toolkit, several Authentication modules, StackTrace, and a few
-other plugins.
-
-A special Win32 version is available upon request that contains many
-more plugins and pre-compiled modules, including DBIx::Class, DBI,
-SQLite, and Session support. If you are interested in this version,
-please send e-mail to C<claco at chrislaco.com>.
-
-=item *
-
-Pre-Built VMWare Images
-
-Under the VMWare community program, work is ongoing to develop a number
-of VMWare images where an entire Catalyst development environment has
-already been installed, complete with database engines and a full
-complement of Catalyst plugins.
-
-=back
-
-=head2 OTHER METHODS
-
-In addition to the "all-in-one" approaches mentioned above, there are a
-variety of other installation techniques:
-
-=over 4
-
-=item *
-
-CPAN
-
-The traditional way to install Catalyst is directly from CPAN using the
-C<Task::Catalyst> bundle and C<Catalyst::Devel>:
-
- $ perl -MCPAN -e 'install Task::Catalyst'
- $ perl -MCPAN -e 'install Catalyst::Devel'
-
-Unless you have a particularly complete set of Perl modules already
-installed, be prepared for a large number of nested dependencies.
-
-=item *
-
-Gentoo Linux
-
-For users of Gentoo, see
-C<http://gentoo-wiki.com/HOWTO_Catalyst_Framework> for automated
-installations. In short, simply mount the portage overlay and type
-C<emerge catalystframework>.
-
-=item *
-
-FreeBSD
-
-FreeBSD users can get up and running quickly by typing C<cd
-/usr/ports/www/p5-Catalyst-Devel && make install>, or C<portinstall
-p5-Catalyst-Devel> if C<portinstall> is installed on your system.
-
-=item *
-
-Windows ActivePerl
-
-Windows users can take advantage of the PPM tool that comes with
-ActivePerl to jumpstart their Catalyst environment. Directions are
-available at L<http://catalyst.infogami.com/install/windows>.
-
-=item *
-
-Subversion Repository
-
-Catalyst uses Subversion for version control. To checkout the latest:
-
- $ svn co http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/
-
-=back
-
-B<NOTE:> Although all of the above methods can be used to install a base
-Catalyst system, only the VMWare image is likely to have all of the
-plugins and modules you need to use Catalyst properly. When you start
-the C<script/myapp_server.pl> development server, it will tell you about
-any modules that are missing. To add them, type something along the
-lines of the following (C<Catalyst::Model::DBIC::Schema> is used here as
-a representative example):
-
- # perl -MCPAN -e 'install Catalyst::Model::DBIC::Schema'
- ...
-
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation.pod (from rev 6895, trunk/Catalyst-Runtime/lib/Catalyst/Manual/Installation.pod)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation.pod (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual/Installation.pod 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,152 @@
+=head1 NAME
+
+Catalyst::Manual::Installation - Catalyst Installation
+
+=head1 DESCRIPTION
+
+How to install Catalyst.
+
+=head1 INSTALLATION
+
+One of the frequent problems reported by new users of Catalyst is that
+it can be extremely time-consuming and difficult to install.
+
+One of the great strengths of Perl as a programming language is its use
+of CPAN, the Comprehensive Perl Archive Network, an enormous global
+repository containing over 10,000 free modules. For almost any basic
+task--and a very large number of non-basic ones--there is a module on
+CPAN that will help you. Catalyst has taken advantage of this, and uses
+a very large number of CPAN modules, rather than reinventing the wheel
+over and over again. On the one hand, Catalyst gains power and
+flexibility through this re-use of existing code. On the other hand,
+Catalyst's reliance on CPAN can complicate initial installations,
+especially in shared-hosting environments where you, the user, do not
+have easy control over what versions of other modules are installed.
+
+It is worth stressing that the difficulties found in installing Catalyst
+are caused not by anything intrinsic to Catalyst itself, but rather by
+the interrelated dependencies of a large number of required modules.
+
+Fortunately, there are a growing number of methods that can dramatically
+ease this undertaking. Note that for many of these, you will probably
+need to install additional Catalyst-related modules (especially plugins)
+to do the things you want. As of version 5.70, Catalyst has split into
+two packages, L<Catalyst::Runtime>, which includes the core elements
+necessary to deploy a Catalyst application, and L<Catalyst::Devel>,
+which includes the Helpers and other things necessary or useful for
+developing Catalyst applications. In a purely deployment environment
+you can omit L<Catalyst::Devel>.
+
+=over 4
+
+=item *
+
+Matt Trout's C<cat-install> script
+
+Available at L<http://www.shadowcatsystems.co.uk/static/cat-install>,
+C<cat-install> can be a quick and painless way to get Catalyst up and
+running on your system. Just download the script from the link above
+and type C<perl cat-install>. This script automates the process of
+installing Catalyst itself and its dependencies, with bits of overriding
+so that the process does not require user interaction. C<cat-install>
+installs Catalyst and its dependencies using the L<CPAN> module, so that
+modules are installed the same way you would probably install them
+normally--it just makes it easier. This is a recommended solution for
+installation.
+
+=item *
+
+Chris Laco's CatInABox
+
+CatInABox is a complete version of Catalyst that is installed locally on
+your system, so that you don't need to go through the effort of doing a
+full install. Simply download the tarball from
+L<http://handelframework.com/downloads/CatInABox.tar.gz> and unpack it
+on your machine. Depending on your OS platform, either run C<start.bat>
+or C<start.sh> to set your bin/PERLLIB paths. This tarball contains
+everything needed to try out Catalyst including Catalyst itself,
+Template Toolkit, several Authentication modules, StackTrace, and a few
+other plugins.
+
+A special Win32 version is available upon request that contains many
+more plugins and pre-compiled modules, including DBIx::Class, DBI,
+SQLite, and Session support. If you are interested in this version,
+please send e-mail to C<claco at chrislaco.com>.
+
+=item *
+
+Pre-Built VMWare Images
+
+Under the VMWare community program, work is ongoing to develop a number
+of VMWare images where an entire Catalyst development environment has
+already been installed, complete with database engines and a full
+complement of Catalyst plugins.
+
+=back
+
+=head2 OTHER METHODS
+
+In addition to the "all-in-one" approaches mentioned above, there are a
+variety of other installation techniques:
+
+=over 4
+
+=item *
+
+CPAN
+
+The traditional way to install Catalyst is directly from CPAN using the
+C<Task::Catalyst> bundle and C<Catalyst::Devel>:
+
+ $ perl -MCPAN -e 'install Task::Catalyst'
+ $ perl -MCPAN -e 'install Catalyst::Devel'
+
+Unless you have a particularly complete set of Perl modules already
+installed, be prepared for a large number of nested dependencies.
+
+=item *
+
+Gentoo Linux
+
+For users of Gentoo, see
+C<http://gentoo-wiki.com/HOWTO_Catalyst_Framework> for automated
+installations. In short, simply mount the portage overlay and type
+C<emerge catalystframework>.
+
+=item *
+
+FreeBSD
+
+FreeBSD users can get up and running quickly by typing C<cd
+/usr/ports/www/p5-Catalyst-Devel && make install>, or C<portinstall
+p5-Catalyst-Devel> if C<portinstall> is installed on your system.
+
+=item *
+
+Windows ActivePerl
+
+Windows users can take advantage of the PPM tool that comes with
+ActivePerl to jumpstart their Catalyst environment. Directions are
+available at L<http://catalyst.infogami.com/install/windows>.
+
+=item *
+
+Subversion Repository
+
+Catalyst uses Subversion for version control. To checkout the latest:
+
+ $ svn co http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/
+
+=back
+
+B<NOTE:> Although all of the above methods can be used to install a base
+Catalyst system, only the VMWare image is likely to have all of the
+plugins and modules you need to use Catalyst properly. When you start
+the C<script/myapp_server.pl> development server, it will tell you about
+any modules that are missing. To add them, type something along the
+lines of the following (C<Catalyst::Model::DBIC::Schema> is used here as
+a representative example):
+
+ # perl -MCPAN -e 'install Catalyst::Model::DBIC::Schema'
+ ...
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual.pm (from rev 6895, trunk/Catalyst-Runtime/lib/Catalyst/Manual.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Manual.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,102 @@
+=head1 NAME
+
+Catalyst::Manual - User guide and reference for Catalyst
+
+=head1 DESCRIPTION
+
+This is the (table of contents page of the) comprehensive user guide and
+reference for Catalyst.
+
+=head1 IMPORTANT NOTE
+
+If you need to read the Catalyst Manual make sure that you have
+Catalyst::Manual installed from cpan. To check that it is installed
+run the following command from a unix (bash) prompt:
+
+ $ 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.
+
+=over 4
+
+=item *
+
+L<Catalyst::Manual::About>
+
+Explanation (without code) of what Catalyst is and why to use it.
+
+=item *
+
+L<Catalyst::Manual::Intro>
+
+Introduction to Catalyst. This is a detailed, if unsystematic, look at
+the basic concepts of Catalyst and what the best practices are for
+writing applications with it.
+
+=item *
+
+L<Catalyst::Manual::Tutorial>
+
+A detailed step-by-step tutorial going through a single application
+thoroughly.
+
+=item *
+
+L<Catalyst::Manual::Plugins>
+
+Catalyst Plugins and Components. A brief look at some of the very many
+modules for extending Catalyst.
+
+=item *
+
+L<Catalyst::Manual::Cookbook>
+
+Cooking with Catalyst. Recipes and solutions that you might want to use
+in your code.
+
+=item *
+
+L<Catalyst::Manual::Installation>
+
+How to install Catalyst, in a variety of different ways. A closer look
+at one of the more difficult issues of using the framework--getting it.
+
+=item *
+
+L<Catalyst::Manual::WritingPlugins>
+
+Writing plugins for Catalyst; the use of L<NEXT>.
+
+=item *
+
+L<Catalyst::Manual::Internals>
+
+Here be dragons! A very brief explanation of the Catalyst request cycle,
+the major components of Catalyst, and how you can use this knowledge
+when writing applications under Catalyst.
+
+=back
+
+=head1 SUPPORT
+
+IRC:
+
+ Join #catalyst on irc.perl.org.
+
+Mailing-Lists:
+
+ http://lists.rawmode.org/mailman/listinfo/catalyst
+ http://lists.rawmode.org/mailman/listinfo/catalyst-dev
+
+=head1 AUTHOR
+
+Sebastian Riedel, C<sri at oook.de>
+Jesse Sheidlower, C<jester at panix.com>
+
+=head1 COPYRIGHT
+
+This program is free software, you can redistribute it and/or modify it
+under the same terms as Perl itself.
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Request.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Request.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Request.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -110,7 +110,7 @@
sub body {
my $self = shift;
$self->_context->prepare_body();
- $self->_body(@_) if scalar @_;
+ croak 'body is a reader' if scalar @_;
return blessed $self->_body ? $self->_body->body : $self->_body;
}
@@ -210,7 +210,7 @@
For example, if your action was
- package MyApp::C::Foo;
+ package MyApp::Controller::Foo;
sub moose : Local {
...
@@ -237,8 +237,9 @@
=head2 $req->body
-Returns the message body of the request, unless Content-Type is
-C<application/x-www-form-urlencoded> or C<multipart/form-data>.
+Returns the message body of the request, as returned by L<HTTP::Body>: a string,
+unless Content-Type is C<application/x-www-form-urlencoded>, C<text/xml>, or
+C<multipart/form-data>, in which case a L<File::Temp> object is returned.
=head2 $req->body_parameters
@@ -300,7 +301,7 @@
print $c->request->cookies->{mycookie}->value;
-The cookies in the hash are indexed by name, and the values are L<CGI::Cookie>
+The cookies in the hash are indexed by name, and the values are L<CGI::Simple::Cookie>
objects.
=head2 $req->header
@@ -569,7 +570,7 @@
=head2 $req->uri
-Returns a URI object for the current request. Stringifies to the URI text.
+Returns a L<URI> object for the current request. Stringifies to the URI text.
=head2 $req->mangle_params( { key => 'value' }, $appendmode);
@@ -675,7 +676,10 @@
=head2 $req->user
Returns the currently logged in user. B<Highly deprecated>, do not call,
-this will be removed in version 5.81.
+this will be removed in version 5.81. To retrieve the currently authenticated
+user, see C<< $c->user >> and C<< $c->user_exists >> in
+L<Catalyst::Plugin::Authentication>. For the C<REMOTE_USER> provided by the
+webserver, see C<< $req->remote_user >> below.
=head2 $req->remote_user
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Response.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Response.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Response.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -65,7 +65,7 @@
=head1 METHODS
-=head2 $res->body(<$text|$fh|$iohandle_object)
+=head2 $res->body( $text | $fh | $iohandle_object )
$c->response->body('Catalyst rocks!');
@@ -102,11 +102,11 @@
Returns a reference to a hash containing cookies to be set. The keys of the
hash are the cookies' names, and their corresponding values are hash
-references used to construct a L<CGI::Cookie> object.
+references used to construct a L<CGI::Simple::Cookie> object.
$c->response->cookies->{foo} = { value => '123' };
-The keys of the hash reference on the right correspond to the L<CGI::Cookie>
+The keys of the hash reference on the right correspond to the L<CGI::Simple::Cookie>
parameters of the same name, except they are used without a leading dash.
Possible parameters are:
@@ -150,7 +150,7 @@
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
+want to C< return > or C<< $c->detach() >> to interrupt the normal
processing flow if you want the redirect to occur straight away.
=cut
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Runtime.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Runtime.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Runtime.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -3,11 +3,11 @@
use strict;
use warnings;
-BEGIN { require 5.008001; }
+BEGIN { require 5.008004; }
# Remember to update this in Catalyst as well!
-our $VERSION='5.80007';
+our $VERSION='5.80014_01';
$VERSION = eval $VERSION;
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Stats.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Stats.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Stats.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -84,6 +84,10 @@
return $node->getUID;
}
+sub created {
+ return @{ shift->{tree}->getNodeValue->{t} };
+}
+
sub elapsed {
return tv_interval(shift->{tree}->getNodeValue->{t});
}
@@ -297,6 +301,13 @@
Returns the UID of the current point in the profile tree. The UID is
automatically assigned if not explicitly given.
+=head2 created
+
+ ($seconds, $microseconds) = $stats->created;
+
+Returns the time the object was created, in C<gettimeofday> format, with
+Unix epoch seconds followed by microseconds.
+
=head2 elapsed
$elapsed = $stats->elapsed
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Test.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Test.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Test.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -228,7 +228,9 @@
$class->handle_request( env => \%ENV );
- return $cgi->restore->response;
+ my $response = $cgi->restore->response;
+ $response->request( $request );
+ return $response;
}
my $agent;
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Upgrading.pod
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Upgrading.pod 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Upgrading.pod 2009-11-24 17:19:15 UTC (rev 12003)
@@ -32,7 +32,8 @@
=head2 Controller actions in Moose roles
-Declaring actions in Roles is currently unsupported.
+You can use L<MooseX::MethodAttributes::Role> if you want to declare actions
+inside Moose roles.
=head2 Using Moose in Components
@@ -304,6 +305,43 @@
=head1 WARNINGS
+=head2 Actions in your application class
+
+Having actions in your application class will now emit a warning at application
+startup as this is deprecated. It is highly recommended that these actions are moved
+into a MyApp::Controller::Root (as demonstrated by the scaffold application
+generated by catalyst.pl).
+
+This warning, also affects tests. You should move actions in your test,
+creating a myTest::Controller::Root, like the following example:
+
+ package MyTest::Controller::Root;
+
+ use strict;
+ use warnings;
+
+ use parent 'Catalyst::Controller';
+
+ __PACKAGE__->config(namespace => '');
+
+ sub action : Local {
+ my ( $self, $c ) = @_;
+ $c->do_something;
+ }
+
+ 1;
+
+=head2 ::[MVC]:: naming scheme
+
+Having packages called MyApp::[MVC]::XX is deprecated and can no longer be generated
+by catalyst.pl
+
+This is still supported, but it is recommended that you rename your application
+components to Model/View/Controller.
+
+A warning will be issued at application startup if the ::[MVC]:: naming scheme is
+in use.
+
=head2 Catalyst::Base
Any code using L<Catalyst::Base> will now emit a warning; this
@@ -363,7 +401,7 @@
Calling the plugin method is deprecated, and calling it at run time is B<highly
deprecated>.
-Instead you are recommended to use L< Catalyst::Model::Adaptor > or similar to
+Instead you are recommended to use L<Catalyst::Model::Adaptor> or similar to
compose the functionality you need outside of the main application name space.
Calling the plugin method will not be supported past Catalyst 5.81.
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Utils.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Utils.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst/Utils.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -124,7 +124,7 @@
Returns a tempdir for a class. If create is true it will try to create the path.
My::App becomes /tmp/my/app
- My::App::C::Foo::Bar becomes /tmp/my/app/c/foo/bar
+ My::App::Controller::Foo::Bar becomes /tmp/my/app/c/foo/bar
=cut
@@ -172,8 +172,9 @@
# pop off /lib and /blib if they're there
$home = $home->parent while $home =~ /b?lib$/;
- # only return the dir if it has a Makefile.PL or Build.PL
- if (-f $home->file("Makefile.PL") or -f $home->file("Build.PL")) {
+ # only return the dir if it has a Makefile.PL or Build.PL or dist.ini
+ if (-f $home->file("Makefile.PL") or -f $home->file("Build.PL")
+ or -f $home->file("dist.ini")) {
# clean up relative path:
# MyApp/script/.. -> MyApp
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/lib/Catalyst.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -4,7 +4,6 @@
use Moose::Meta::Class ();
extends 'Catalyst::Component';
use Moose::Util qw/find_meta/;
-use bytes;
use B::Hooks::EndOfScope ();
use Catalyst::Exception;
use Catalyst::Exception::Detach;
@@ -27,11 +26,12 @@
use Tree::Simple qw/use_weak_refs/;
use Tree::Simple::Visitor::FindByUID;
use Class::C3::Adopt::NEXT;
+use List::MoreUtils qw/uniq/;
use attributes;
use utf8;
use Carp qw/croak carp shortmess/;
-BEGIN { require 5.008001; }
+BEGIN { require 5.008004; }
has stack => (is => 'ro', default => sub { [] });
has stash => (is => 'rw', default => sub { {} });
@@ -78,7 +78,7 @@
# Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.80007';
+our $VERSION = '5.80014_01';
{
my $dev_version = $VERSION =~ /_\d{2}$/;
@@ -335,9 +335,11 @@
$c->forward(qw/MyApp::Model::DBIC::Foo do_stuff/);
$c->forward('MyApp::View::TT');
-Note that forward implies an C<<eval { }>> around the call (actually
-C<execute> does), thus de-fatalizing all 'dies' within the called
-action. If you want C<die> to propagate you need to do something like:
+Note that L<< forward|/"$c->forward( $action [, \@arguments ] )" >> implies
+an C<< eval { } >> around the call (actually
+L<< execute|/"$c->execute( $class, $coderef )" >> does), thus de-fatalizing
+all 'dies' within the called action. If you want C<die> to propagate you
+need to do something like:
$c->forward('foo');
die $c->error if $c->error;
@@ -346,7 +348,22 @@
your code like this:
$c->forward('foo') || return;
+
+Another note is that C<< $c->forward >> always returns a scalar because it
+actually returns $c->state which operates in a scalar context.
+Thus, something like:
+ return @array;
+
+in an action that is forwarded to is going to return a scalar,
+i.e. how many items are in that array, which is probably not what you want.
+If you need to return an array then return a reference to it,
+or stash it like so:
+
+ $c->stash->{array} = \@array;
+
+and access it from the stash.
+
=cut
sub forward { my $c = shift; no warnings 'recursion'; $c->dispatcher->forward( $c, @_ ) }
@@ -357,8 +374,8 @@
=head2 $c->detach()
-The same as C<forward>, but doesn't return to the previous action when
-processing is finished.
+The same as L<< forward|/"$c->forward( $action [, \@arguments ] )" >>, but
+doesn't return to the previous action when processing is finished.
When called with no arguments it escapes the processing chain entirely.
@@ -370,23 +387,27 @@
=head2 $c->visit( $class, $method, [, \@captures, \@arguments ] )
-Almost the same as C<forward>, but does a full dispatch, instead of just
-calling the new C<$action> / C<$class-E<gt>$method>. This means that C<begin>,
-C<auto> and the method you go to are called, just like a new request.
+Almost the same as L<< forward|/"$c->forward( $action [, \@arguments ] )" >>,
+but does a full dispatch, instead of just calling the new C<$action> /
+C<< $class->$method >>. This means that C<begin>, C<auto> and the method
+you go to are called, just like a new request.
In addition both C<< $c->action >> and C<< $c->namespace >> are localized.
-This means, for example, that $c->action methods such as C<name>, C<class> and
-C<reverse> return information for the visited action when they are invoked
-within the visited action. This is different from the behavior of C<forward>
-which continues to use the $c->action object from the caller action even when
+This means, for example, that C<< $c->action >> methods such as
+L<name|Catalyst::Action/name>, L<class|Catalyst::Action/class> and
+L<reverse|Catalyst::Action/reverse> return information for the visited action
+when they are invoked within the visited action. This is different from the
+behavior of L<< forward|/"$c->forward( $action [, \@arguments ] )" >>, which
+continues to use the $c->action object from the caller action even when
invoked from the callee.
-C<$c-E<gt>stash> is kept unchanged.
+C<< $c->stash >> is kept unchanged.
-In effect, C<visit> allows you to "wrap" another action, just as it
-would have been called by dispatching from a URL, while the analogous
-C<go> allows you to transfer control to another action as if it had
-been reached directly from a URL.
+In effect, L<< visit|/"$c->visit( $action [, \@captures, \@arguments ] )" >>
+allows you to "wrap" another action, just as it would have been called by
+dispatching from a URL, while the analogous
+L<< go|/"$c->go( $action [, \@captures, \@arguments ] )" >> allows you to
+transfer control to another action as if it had been reached directly from a URL.
=cut
@@ -396,13 +417,16 @@
=head2 $c->go( $class, $method, [, \@captures, \@arguments ] )
-Almost the same as C<detach>, but does a full dispatch like C<visit>,
-instead of just calling the new C<$action> /
-C<$class-E<gt>$method>. This means that C<begin>, C<auto> and the
-method you visit are called, just like a new request.
+The relationship between C<go> and
+L<< visit|/"$c->visit( $action [, \@captures, \@arguments ] )" >> is the same as
+the relationship between
+L<< forward|/"$c->forward( $class, $method, [, \@arguments ] )" >> and
+L<< detach|/"$c->detach( $action [, \@arguments ] )" >>. Like C<< $c->visit >>,
+C<< $c->go >> will perform a full dispatch on the specified action or method,
+with localized C<< $c->action >> and C<< $c->namespace >>. Like C<detach>,
+C<go> escapes the processing of the current request chain on completion, and
+does not return to its caller.
-C<$c-E<gt>stash> is kept unchanged.
-
=cut
sub go { my $c = shift; $c->dispatcher->go( $c, @_ ) }
@@ -480,7 +504,9 @@
=head2 $c->state
-Contains the return value of the last executed action.
+Contains the return value of the last executed action.
+Note that << $c->state >> operates in a scalar context which means that all
+values it returns are scalar.
=head2 $c->clear_errors
@@ -525,6 +551,10 @@
# if we were given a regexp to search against, we're done.
return if ref $name;
+ # skip regexp fallback if configured
+ return
+ if $appclass->config->{disable_component_resolution_regex_fallback};
+
# regexp fallback
$query = qr/$name/i;
@result = grep { $eligible{ $_ } =~ m{$query} } keys %eligible;
@@ -542,7 +572,8 @@
(join '", "', @result) . "'. Relying on regexp fallback behavior for " .
"component resolution is unreliable and unsafe.";
my $short = $result[0];
- $short =~ s/.*?Model:://;
+ # remove the component namespace prefix
+ $short =~ s/.*?(Model|Controller|View):://;
my $shortmess = Carp::shortmess('');
if ($shortmess =~ m#Catalyst/Plugin#) {
$msg .= " You probably need to set '$short' instead of '${name}' in this " .
@@ -551,7 +582,7 @@
$msg .= " You probably need to set '$short' instead of '${name}' in this " .
"component's config";
} else {
- $msg .= " You probably meant \$c->${warn_for}('$short') instead of \$c->${warn_for}({'${name}'}), " .
+ $msg .= " You probably meant \$c->${warn_for}('$short') instead of \$c->${warn_for}('${name}'), " .
"but if you really wanted to search, pass in a regexp as the argument " .
"like so: \$c->${warn_for}(qr/${name}/)";
}
@@ -639,7 +670,7 @@
sub model {
my ( $c, $name, @args ) = @_;
-
+ my $appclass = ref($c) || $c;
if( $name ) {
my @result = $c->_comp_search_prefixes( $name, qw/Model M/ );
return map { $c->_filter_component( $_, @args ) } @result if ref $name;
@@ -652,8 +683,8 @@
return $c->model( $c->stash->{current_model} )
if $c->stash->{current_model};
}
- return $c->model( $c->config->{default_model} )
- if $c->config->{default_model};
+ return $c->model( $appclass->config->{default_model} )
+ if $appclass->config->{default_model};
my( $comp, $rest ) = $c->_comp_search_prefixes( undef, qw/Model M/);
@@ -693,6 +724,7 @@
sub view {
my ( $c, $name, @args ) = @_;
+ my $appclass = ref($c) || $c;
if( $name ) {
my @result = $c->_comp_search_prefixes( $name, qw/View V/ );
return map { $c->_filter_component( $_, @args ) } @result if ref $name;
@@ -705,8 +737,8 @@
return $c->view( $c->stash->{current_view} )
if $c->stash->{current_view};
}
- return $c->view( $c->config->{default_view} )
- if $c->config->{default_view};
+ return $c->view( $appclass->config->{default_view} )
+ if $appclass->config->{default_view};
my( $comp, $rest ) = $c->_comp_search_prefixes( undef, qw/View V/);
@@ -767,6 +799,12 @@
If C<$name> is a regexp, a list of components matched against the full
component name will be returned.
+If Catalyst can't find a component by name, it will fallback to regex
+matching by default. To disable this behaviour set
+disable_component_resolution_regex_fallback to a true value.
+
+ __PACKAGE__->config( disable_component_resolution_regex_fallback => 1 );
+
=cut
sub component {
@@ -818,8 +856,8 @@
__PACKAGE__->config( { db => 'dsn:SQLite:foo.db' } );
-You can also use a C<YAML>, C<XML> or C<Config::General> config file
-like myapp.conf in your applications home directory. See
+You can also use a C<YAML>, C<XML> or L<Config::General> config file
+like C<myapp.conf> in your applications home directory. See
L<Catalyst::Plugin::ConfigLoader>.
=head3 Cascading configuration
@@ -918,7 +956,7 @@
Merges C<@path> with C<< $c->config->{home} >> and returns a
L<Path::Class::Dir> object. Note you can usually use this object as
a filename, but sometimes you will have to explicitly stringify it
-yourself by calling the C<<->stringify>> method.
+yourself by calling the C<< ->stringify >> method.
For example:
@@ -1106,7 +1144,6 @@
my $name = $class->config->{name} || 'Application';
$class->log->info("$name powered by Catalyst $Catalyst::VERSION");
}
- $class->log->_flush() if $class->log->can('_flush');
# Make sure that the application class becomes immutable at this point,
B::Hooks::EndOfScope::on_scope_end {
@@ -1126,11 +1163,21 @@
. "Class::Accessor(::Fast)?\nPlease pass "
. "(replace_constructor => 1)\nwhen making your class immutable.\n";
}
- $meta->make_immutable(replace_constructor => 1)
- unless $meta->is_immutable;
+ $meta->make_immutable(
+ replace_constructor => 1,
+ ) unless $meta->is_immutable;
};
+ if ($class->config->{case_sensitive}) {
+ $class->log->warn($class . "->config->{case_sensitive} is set.");
+ $class->log->warn("This setting is deprecated and planned to be removed in Catalyst 5.81.");
+ }
+
$class->setup_finalize;
+ # Should be the last thing we do so that user things hooking
+ # setup_finalize can log..
+ $class->log->_flush() if $class->log->can('_flush');
+ return 1; # Explicit return true as people have __PACKAGE__->setup as the last thing in their class. HATE.
}
@@ -1158,41 +1205,63 @@
$class->setup_finished(1);
}
+=head2 $c->uri_for( $path?, @args?, \%query_values? )
+
=head2 $c->uri_for( $action, \@captures?, @args?, \%query_values? )
-=head2 $c->uri_for( $path, @args?, \%query_values? )
+Constructs an absolute L<URI> object based on the application root, the
+provided path, and the additional arguments and query parameters provided.
+When used as a string, provides a textual URI.
-=over
+If no arguments are provided, the URI for the current action is returned.
+To return the current action and also provide @args, use
+C<< $c->uri_for( $c->action, @args ) >>.
-=item $action
+If the first argument is a string, it is taken as a public URI path relative
+to C<< $c->namespace >> (if it doesn't begin with a forward slash) or
+relative to the application root (if it does). It is then merged with
+C<< $c->request->base >>; any C<@args> are appended as additional path
+components; and any C<%query_values> are appended as C<?foo=bar> parameters.
-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.
+If the first argument is a L<Catalyst::Action> it represents an action which
+will have its path resolved using C<< $c->dispatcher->uri_for_action >>. The
+optional C<\@captures> argument (an arrayref) allows passing the captured
+variables that are needed to fill in the paths of Chained and Regex actions;
+once the path is resolved, C<uri_for> continues as though a path was
+provided, appending any arguments or parameters and creating an absolute
+URI.
-You can maintain the arguments captured by an action (e.g.: Regex, Chained)
-using C<< $c->req->captures >>.
+The captures for the current request can be found in
+C<< $c->request->captures >>, and actions can be resolved using
+C<< Catalyst::Controller->action_for($name) >>. If you have a private action
+path, use C<< $c->uri_for_action >> instead.
- # For the current action
- $c->uri_for($c->action, $c->req->captures);
+ # Equivalent to $c->req->uri
+ $c->uri_for($c->action, $c->req->captures,
+ @{ $c->req->args }, $c->req->params);
# For the Foo action in the Bar controller
- $c->uri_for($c->controller('Bar')->action_for('Foo'), $c->req->captures);
+ $c->uri_for($c->controller('Bar')->action_for('Foo'));
-=back
+ # Path to a static resource
+ $c->uri_for('/static/images/logo.png');
=cut
sub uri_for {
my ( $c, $path, @args ) = @_;
+ if (blessed($path) && $path->isa('Catalyst::Controller')) {
+ $path = $path->path_prefix;
+ $path =~ s{/+\z}{};
+ $path .= '/';
+ }
+
if ( blessed($path) ) { # action object
- $c->dispatcher->splice_captures_from( $c, $path, \@args );
- my $captures = ( scalar @args && ref $args[0] eq 'ARRAY'
- ? shift(@args)
- : [] );
+ my $captures = [ map { s|/|%2F|; $_; }
+ ( scalar @args && ref $args[0] eq 'ARRAY'
+ ? @{ shift(@args) }
+ : ()) ];
my $action = $path;
$path = $c->dispatcher->uri_for_action($action, $captures);
if (not defined $path) {
@@ -1210,6 +1279,7 @@
carp "uri_for called with undef argument" if grep { ! defined $_ } @args;
s/([^$URI::uric])/$URI::Escape::escapes{$1}/go for @args;
+ s|/|%2F| for @args;
unshift(@args, $path);
@@ -1542,9 +1612,9 @@
sub _stats_start_execute {
my ( $c, $code ) = @_;
-
+ my $appclass = ref($c) || $c;
return if ( ( $code->name =~ /^_.*/ )
- && ( !$c->config->{show_internal_actions} ) );
+ && ( !$appclass->config->{show_internal_actions} ) );
my $action_name = $code->reverse();
$c->counter->{$action_name}++;
@@ -1572,9 +1642,10 @@
# is this a root-level call or a forwarded call?
if ( $callsub =~ /forward$/ ) {
+ my $parent = $c->stack->[-1];
# forward, locate the caller
- if ( my $parent = $c->stack->[-1] ) {
+ if ( exists $c->counter->{"$parent"} ) {
$c->stats->profile(
begin => $action,
parent => "$parent" . $c->counter->{"$parent"},
@@ -1607,25 +1678,6 @@
$c->stats->profile( end => $info );
}
-=head2 $c->_localize_fields( sub { }, \%keys );
-
-=cut
-
-#Why does this exist? This is no longer safe and WILL NOT WORK.
-# it doesnt seem to be used anywhere. can we remove it?
-sub _localize_fields {
- my ( $c, $localized, $code ) = ( @_ );
-
- my $request = delete $localized->{request} || {};
- my $response = delete $localized->{response} || {};
-
- local @{ $c }{ keys %$localized } = values %$localized;
- local @{ $c->request }{ keys %$request } = values %$request;
- local @{ $c->response }{ keys %$response } = values %$response;
-
- $code->();
-}
-
=head2 $c->finalize
Finalizes the request.
@@ -1740,7 +1792,7 @@
}
else {
# everything should be bytes at this point, but just in case
- $response->content_length( bytes::length( $response->body ) );
+ $response->content_length( length( $response->body ) );
}
}
@@ -1877,7 +1929,7 @@
$c->prepare_read;
# Parse the body unless the user wants it on-demand
- unless ( $c->config->{parse_on_demand} ) {
+ unless ( ref($c)->config->{parse_on_demand} ) {
$c->prepare_body;
}
}
@@ -2128,40 +2180,32 @@
=head2 $c->setup_components
-Sets up components. Specify a C<setup_components> config option to pass
-additional options directly to L<Module::Pluggable>. To add additional
-search paths, specify a key named C<search_extra> as an array
-reference. Items in the array beginning with C<::> will have the
-application class name prepended to them.
+This method is called internally to set up the application's components.
-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.
+It finds modules by calling the L<locate_components> method, expands them to
+package names with the L<expand_component_module> method, and then installs
+each component into the application.
+The C<setup_components> config option is passed to both of the above methods.
+
+Installation of each component is performed by the L<setup_component> method,
+below.
+
=cut
sub setup_components {
my $class = shift;
- my @paths = qw( ::Controller ::C ::Model ::M ::View ::V );
my $config = $class->config->{ setup_components };
- my $extra = delete $config->{ search_extra } || [];
- push @paths, @$extra;
-
- my $locator = Module::Pluggable::Object->new(
- search_path => [ map { s/^(?=::)/$class/; $_; } @paths ],
- %$config
- );
-
- my @comps = sort { length $a <=> length $b } $locator->plugins;
+ my @comps = sort { length $a <=> length $b }
+ $class->locate_components($config);
my %comps = map { $_ => 1 } @comps;
- my $deprecated_component_names = grep { /::[CMV]::/ } @comps;
+ my $deprecatedcatalyst_component_names = grep { /::[CMV]::/ } @comps;
$class->log->warn(qq{Your application is using the deprecated ::[MVC]:: type naming scheme.\n}.
qq{Please switch your class names to ::Model::, ::View:: and ::Controller: as appropriate.\n}
- ) if $deprecated_component_names;
+ ) if $deprecatedcatalyst_component_names;
for my $component ( @comps ) {
@@ -2170,30 +2214,76 @@
# we know M::P::O found a file on disk so this is safe
Catalyst::Utils::ensure_class_loaded( $component, { ignore_loaded => 1 } );
- #Class::MOP::load_class($component);
- my $module = $class->setup_component( $component );
- my %modules = (
- $component => $module,
- map {
- $_ => $class->setup_component( $_ )
- } grep {
- not exists $comps{$_}
- } Devel::InnerPackage::list_packages( $component )
- );
+ # Needs to be done as soon as the component is loaded, as loading a sub-component
+ # (next time round the loop) can cause us to get the wrong metaclass..
+ $class->_controller_init_base_classes($component);
+ }
- for my $key ( keys %modules ) {
- $class->components->{ $key } = $modules{ $key };
+ for my $component (@comps) {
+ $class->components->{ $component } = $class->setup_component($component);
+ for my $component ($class->expand_component_module( $component, $config )) {
+ next if $comps{$component};
+ $class->_controller_init_base_classes($component); # Also cover inner packages
+ $class->components->{ $component } = $class->setup_component($component);
}
}
}
+=head2 $c->locate_components( $setup_component_config )
+
+This method is meant to provide a list of component modules that should be
+setup for the application. By default, it will use L<Module::Pluggable>.
+
+Specify a C<setup_components> config option to pass additional options directly
+to L<Module::Pluggable>. To add additional search paths, specify a key named
+C<search_extra> as an array reference. Items in the array beginning with C<::>
+will have the application class name prepended to them.
+
+=cut
+
+sub locate_components {
+ my $class = shift;
+ my $config = shift;
+
+ my @paths = qw( ::Controller ::C ::Model ::M ::View ::V );
+ my $extra = delete $config->{ search_extra } || [];
+
+ push @paths, @$extra;
+
+ my $locator = Module::Pluggable::Object->new(
+ search_path => [ map { s/^(?=::)/$class/; $_; } @paths ],
+ %$config
+ );
+
+ my @comps = $locator->plugins;
+
+ return @comps;
+}
+
+=head2 $c->expand_component_module( $component, $setup_component_config )
+
+Components found by C<locate_components> will be passed to this method, which
+is expected to return a list of component (package) names to be set up.
+
+=cut
+
+sub expand_component_module {
+ my ($class, $module) = @_;
+ return Devel::InnerPackage::list_packages( $module );
+}
+
=head2 $c->setup_component
=cut
+# FIXME - Ugly, ugly hack to ensure the we force initialize non-moose base classes
+# nearest to Catalyst::Controller first, no matter what order stuff happens
+# to be loaded. There are TODO tests in Moose for this, see
+# f2391d17574eff81d911b97be15ea51080500003
sub _controller_init_base_classes {
my ($app_class, $component) = @_;
+ return unless $component->isa('Catalyst::Controller');
foreach my $class ( reverse @{ mro::get_linear_isa($component) } ) {
Moose::Meta::Class->initialize( $class )
unless find_meta($class);
@@ -2207,16 +2297,12 @@
return $component;
}
- # FIXME - Ugly, ugly hack to ensure the we force initialize non-moose base classes
- # nearest to Catalyst::Controller first, no matter what order stuff happens
- # to be loaded. There are TODO tests in Moose for this, see
- # f2391d17574eff81d911b97be15ea51080500003
- if ($component->isa('Catalyst::Controller')) {
- $class->_controller_init_base_classes($component);
- }
-
my $suffix = Catalyst::Utils::class2classsuffix( $component );
my $config = $class->config->{ $suffix } || {};
+ # Stash catalyst_component_name in the config here, so that custom COMPONENT
+ # methods also pass it. local to avoid pointlessly shitting in config
+ # for the debug screen, as $component is already the key name.
+ local $config->{catalyst_component_name} = $component;
my $instance = eval { $component->COMPONENT( $class, $config ); };
@@ -2500,7 +2586,8 @@
my $class = ref $proto || $proto;
Class::MOP::load_class( $plugin );
-
+ $class->log->warn( "$plugin inherits from 'Catalyst::Component' - this is decated and will not work in 5.81" )
+ if $plugin->isa( 'Catalyst::Component' );
$proto->_plugins->{$plugin} = 1;
unless ($instant) {
no strict 'refs';
@@ -2591,6 +2678,73 @@
sub version { return $Catalyst::VERSION }
+=head1 CONFIGURATION
+
+There are a number of 'base' config variables which can be set:
+
+=over
+
+=item *
+
+C<default_model> - The default model picked if you say C<< $c->model >>. See L</$c->model($name)>.
+
+=item *
+
+C<default_view> - The default view to be rendered or returned when C<< $c->view >>. See L</$c->view($name)>.
+is called.
+
+=item *
+
+C<disable_component_resolution_regex_fallback> - Turns
+off the deprecated component resolution functionality so
+that if any of the component methods (e.g. C<< $c->controller('Foo') >>)
+are called then regex search will not be attempted on string values and
+instead C<undef> will be returned.
+
+=item *
+
+C<home> - The application home directory. In an uninstalled application,
+this is the top level application directory. In an installed application,
+this will be the directory containing C<< MyApp.pm >>.
+
+=item *
+
+C<ignore_frontend_proxy> - See L</PROXY SUPPORT>
+
+=item *
+
+C<name> - The name of the application in debug messages and the debug and
+welcome screens
+
+=item *
+
+C<parse_on_demand> - The request body (for example file uploads) will not be parsed
+until it is accessed. This allows you to (for example) check authentication (and reject
+the upload) before actually recieving all the data. See L</ON-DEMAND PARSER>
+
+=item *
+
+C<root> - The root directory for templates. Usually this is just a
+subdirectory of the home directory, but you can set it to change the
+templates to a different directory.
+
+=item *
+
+C<search_extra> - Array reference passed to Module::Pluggable to for additional
+namespaces from which components will be loaded (and constructed and stored in
+C<< $c->components >>).
+
+=item *
+
+C<show_internal_actions> - If true, causes internal actions such as C<< _DISPATCH >>
+to be shown in hit debug tables in the test server.
+
+=item *
+
+C<using_frontend_proxy> - See L</PROXY SUPPORT>.
+
+=back
+
=head1 INTERNAL ACTIONS
Catalyst uses internal actions like C<_DISPATCH>, C<_BEGIN>, C<_AUTO>,
@@ -2599,16 +2753,6 @@
MyApp->config(show_internal_actions => 1);
-=head1 CASE SENSITIVITY
-
-By default Catalyst is not case sensitive, so C<MyApp::C::FOO::Bar> is
-mapped to C</foo/bar>. You can activate case sensitivity with a config
-parameter.
-
- MyApp->config(case_sensitive => 1);
-
-This causes C<MyApp::C::Foo::Bar> to map to C</Foo/Bar>.
-
=head1 ON-DEMAND PARSER
The request body is usually parsed at the beginning of a request,
@@ -2636,6 +2780,18 @@
The host value for $c->req->base and $c->req->uri is set to the real
host, as read from the HTTP X-Forwarded-Host header.
+Additionally, you may be running your backend application on an insecure
+connection (port 80) while your frontend proxy is running under SSL. If there
+is a discrepancy in the ports, use the HTTP header C<X-Forwarded-Port> to
+tell Catalyst what port the frontend listens on. This will allow all URIs to
+be created properly.
+
+In the case of passing in:
+
+ X-Forwarded-Port: 443
+
+All calls to C<uri_for> will result in an https link, as is expected.
+
Obviously, your web server must support these headers for this to work.
In a more complex server farm environment where you may have your
@@ -2684,7 +2840,7 @@
=head2 L<Catalyst::Manual> - The Catalyst Manual
-=head2 L<Catalyst::Component>, L<Catalyst::Base> - Base classes for components
+=head2 L<Catalyst::Component>, L<Catalyst::Controller> - Base classes for components
=head2 L<Catalyst::Engine> - Core engine
@@ -2706,9 +2862,11 @@
acme: Leon Brocard <leon at astray.com>
+abraxxa: Alexander Hartmaier <abraxxa at cpan.org>
+
Andrew Bramble
-Andrew Ford
+Andrew Ford E<lt>A.Ford at ford-mason.co.ukE<gt>
Andrew Ruthven
@@ -2724,6 +2882,14 @@
chicks: Christopher Hicks
+Chisel Wright C<pause at herlpacker.co.uk>
+
+Danijel Milicevic C<me at danijel.de>
+
+David Kamholz E<lt>dkamholz at cpan.orgE<gt>
+
+David Naughton, C<naughton at umn.edu>
+
David E. Wheeler
dkubb: Dan Kubb <dan.kubb-cpan at onautopilot.com>
@@ -2736,16 +2902,26 @@
fireartist: Carl Franks <cfranks at cpan.org>
+frew: Arthur Axel "fREW" Schmidt <frioux at gmail.com>
+
gabb: Danijel Milicevic
Gary Ashton Jones
+Gavin Henry C<ghenry at perl.me.uk>
+
Geoff Richards
+groditi: Guillermo Roditi <groditi at gmail.com>
+
+hobbs: Andrew Rodland <andrew at cleverdomain.org>
+
ilmari: Dagfinn Ilmari Mannsåker <ilmari at ilmari.org>
jcamacho: Juan Camacho
+jester: Jesse Sheidlower C<jester at panix.com>
+
jhannah: Jay Hannah <jay at jays.net>
Jody Belka
@@ -2754,6 +2930,12 @@
jon: Jon Schutz <jjschutz at cpan.org>
+Jonathan Rockway C<< <jrockway at cpan.org> >>
+
+Kieren Diment C<kd at totaldatasolution.com>
+
+konobi: Scott McWhirter <konobi at cpan.org>
+
marcus: Marcus Ramberg <mramberg at cpan.org>
miyagawa: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
@@ -2782,16 +2964,22 @@
random: Roland Lammel <lammel at cpan.org>
+Robert Sedlacek C<< <rs at 474.at> >>
+
sky: Arthur Bergman
-the_jester: Jesse Sheidlower
-
t0m: Tomas Doran <bobtfish at bobtfish.net>
Ulf Edvinsson
+Viljo Marrandi C<vilts at yahoo.com>
+
+Will Hawes C<info at whawes.co.uk>
+
willert: Sebastian Willert <willert at cpan.org>
+Yuval Kogman, C<nothingmuch at woobling.org>
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify it under
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/script/catalyst.pl
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/script/catalyst.pl 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/script/catalyst.pl 2009-11-24 17:19:15 UTC (rev 12003)
@@ -26,14 +26,12 @@
my $help = 0;
my $makefile = 0;
my $scripts = 0;
-my $short = 0;
GetOptions(
'help|?' => \$help,
'force|nonew' => \$force,
'makefile' => \$makefile,
'scripts' => \$scripts,
- 'short' => \$short
);
pod2usage(1) if ( $help || !$ARGV[0] );
@@ -43,7 +41,7 @@
'.newfiles' => !$force,
'makefile' => $makefile,
'scripts' => $scripts,
- 'short' => $short,
+ 'short' => 0, # FIXME - to be removed.
}
);
pod2usage(1) unless $helper->mk_app( $ARGV[0] );
@@ -67,7 +65,6 @@
-help display this help and exit
-makefile only update Makefile.PL
-scripts only update helper scripts
- -short use short names, M/V/C instead of Model/View/Controller.
application-name must be a valid Perl module name and can include "::",
which will be converted to '-' in the project name.
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/02pod.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/02pod.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/02pod.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -2,6 +2,6 @@
eval "use Test::Pod 1.14";
plan skip_all => 'Test::Pod 1.14 required' if $@;
-plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD} || -e 'inc/.author';
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD} || -f 'MANIFEST.SKIP';
all_pod_files_ok();
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/03podcoverage.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/03podcoverage.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/03podcoverage.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,13 +1,7 @@
use Test::More;
-eval "use Pod::Coverage 0.19";
-plan skip_all => 'Pod::Coverage 0.19 required' if $@;
eval "use Test::Pod::Coverage 1.04";
plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
-plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD} || -e 'inc/.author';
+plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD} || -f 'MANIFEST.SKIP';
-all_pod_coverage_ok(
- {
- also_private => ['BUILD']
- }
-);
+all_pod_coverage_ok();
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/04critic.rc (from rev 6895, trunk/Catalyst-Runtime/t/04critic.rc)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/04critic.rc (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/04critic.rc 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,5 @@
+include = CodeLayout::ProhibitHardTabs
+only = 1
+
+[CodeLayout::ProhibitHardTabs]
+allow_leading_tabs = 0
\ No newline at end of file
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/04critic.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/04critic.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/04critic.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -9,13 +9,14 @@
plan skip_all => 'Critic test only for developers.';
}
else {
- eval { require Test::NoTabs };
+ eval { require Test::Perl::Critic };
if ( $@ ) {
plan tests => 1;
- fail( 'You must install Test::NoTabs to run 04critic.t' );
+ fail( 'You must install Test::Perl::Critic to run 04critic.t' );
exit;
}
}
-Test::NoTabs->import;
-all_perl_files_ok(qw/lib/);
+my $rcfile = File::Spec->catfile( 't', '04critic.rc' );
+Test::Perl::Critic->import( -profile => $rcfile );
+all_critic_ok();
\ No newline at end of file
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/c3_appclass_bug.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/c3_appclass_bug.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/c3_appclass_bug.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/c3_appclass_bug.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,30 @@
+use strict;
+use Test::More tests => 1;
+
+{
+ package TestPlugin;
+ use strict;
+
+ sub setup {
+ shift->maybe::next::method(@_);
+ }
+}
+{
+ package TestAppC3ErrorUseMoose;
+ use Moose;
+
+ use Catalyst::Runtime 5.80;
+
+ use base qw/Catalyst/;
+ use Catalyst qw/
+ +TestPlugin
+ /;
+}
+
+use Test::Exception;
+lives_ok {
+ TestAppC3ErrorUseMoose->setup();
+} 'No C3 error';
+
+1;
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/c3_mro.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/c3_mro.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/c3_mro.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/c3_mro.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,38 @@
+use strict;
+use warnings;
+
+use Test::More;
+require Catalyst;
+require Module::Pluggable::Object;
+use MRO::Compat;
+
+# Get a list of all Catalyst:: packages in blib via M::P::O
+my @cat_mods;
+{
+ # problem with @INC on win32, see:
+ # http://rt.cpan.org/Ticket/Display.html?id=26452
+ if ($^O eq 'MSWin32') { require Win32; Win32::GetCwd(); }
+
+ local @INC = grep {/blib/} @INC;
+ @cat_mods = (
+ 'Catalyst',
+ Module::Pluggable::Object->new(search_path => ['Catalyst'])->plugins,
+ );
+}
+
+# plan one test per found package name
+plan tests => scalar @cat_mods;
+
+# Try to calculate the C3 MRO for each package
+#
+# In the case that the initial require fails (as in
+# Catalyst::Engine::FastCGI when FCGI is not installed),
+# the calculateMRO eval will not error out, which is
+# effectively a test skip.
+#
+foreach my $cat_mod (@cat_mods) {
+ eval " require $cat_mod ";
+ eval { mro::get_linear_isa($cat_mod, 'c3') };
+ ok(!$@, "calculateMRO for $cat_mod: $@");
+}
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/caf_backcompat.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/caf_backcompat.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/caf_backcompat.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/caf_backcompat.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,28 @@
+use strict;
+use warnings;
+use Test::More;
+use Test::Exception;
+use Class::MOP ();
+use Moose::Util ();
+
+# List of everything which used Class::Accessor::Fast in 5.70.
+my @modules = qw/
+ Catalyst::Action
+ Catalyst::ActionContainer
+ Catalyst::Component
+ Catalyst::Dispatcher
+ Catalyst::DispatchType
+ Catalyst::Engine
+ Catalyst::Log
+ Catalyst::Request::Upload
+ Catalyst::Request
+ Catalyst::Response
+/;
+
+plan tests => scalar @modules;
+
+foreach my $module (@modules) {
+ Class::MOP::load_class($module);
+ ok Moose::Util::does_role($module => 'MooseX::Emulate::Class::Accessor::Fast'),
+ "$module has Class::Accessor::Fast back-compat";
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/custom_live_component_controller_action_auto_doublebug.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/custom_live_component_controller_action_auto_doublebug.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/custom_live_component_controller_action_auto_doublebug.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/custom_live_component_controller_action_auto_doublebug.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,48 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 3*$iters;
+use Catalyst::Test 'TestAppDoubleAutoBug';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip 'Using remote server', 3;
+ }
+
+ {
+ my @expected = qw[
+ TestAppDoubleAutoBug::Controller::Root->auto
+ TestAppDoubleAutoBug::Controller::Root->default
+ TestAppDoubleAutoBug::Controller::Root->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/auto/one'), 'auto + local' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'default, auto=1', 'Content OK' );
+ }
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/custom_live_path_bug.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/custom_live_path_bug.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/custom_live_path_bug.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/custom_live_path_bug.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,39 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 2*$iters;
+use Catalyst::Test 'TestAppPathBug';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip 'Using remote server', 2;
+ }
+
+ {
+ my $expected = 'This is the foo method.';
+ ok( my $response = request('http://localhost/'), 'response ok' );
+ is( $response->content, $expected, 'Content OK' );
+ }
+ }
+}
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_auto.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_auto.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_auto.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -35,7 +35,7 @@
TestApp::Controller::Action::Auto->begin
TestApp::Controller::Action::Auto->auto
TestApp::Controller::Action::Auto->one
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -52,7 +52,7 @@
TestApp::Controller::Action::Auto->begin
TestApp::Controller::Action::Auto->auto
TestApp::Controller::Action::Auto->default
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -70,7 +70,7 @@
TestApp::Controller::Action::Auto->auto
TestApp::Controller::Action::Auto::Deep->auto
TestApp::Controller::Action::Auto::Deep->one
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -88,7 +88,7 @@
TestApp::Controller::Action::Auto->auto
TestApp::Controller::Action::Auto::Deep->auto
TestApp::Controller::Action::Auto::Deep->default
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_begin.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_begin.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_begin.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -30,7 +30,7 @@
TestApp::Controller::Action::Begin->begin
TestApp::Controller::Action::Begin->default
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_chained.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_chained.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_chained.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -10,7 +10,7 @@
BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 148*$iters;
+use Test::More;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
@@ -815,7 +815,7 @@
my @expected = qw[
TestApp::Controller::Action::Chained::Root->rootsub
TestApp::Controller::Action::Chained::Root->endpointsub
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -1018,5 +1018,31 @@
'request with URI-encoded arg' );
like( $content, qr{foo/bar;\z}, 'args decoded' );
}
+
+ # Test round tripping, specifically the / character %2F in uri_for:
+ # not being able to feed it back action + captureargs and args into uri for
+ # and result in the original request uri is a major piece of suck ;)
+ foreach my $thing (
+ ['foo', 'bar'],
+ ['foo%2Fbar', 'baz'],
+ ['foo', 'bar%2Fbaz'],
+ ['foo%2Fbar', 'baz%2Fquux'],
+ ['foo%2Fbar', 'baz%2Fquux', { foo => 'bar', 'baz' => 'quux%2Ffrood'}],
+ ['foo%2Fbar', 'baz%2Fquux', { foo => 'bar', 'baz%2Ffnoo' => 'quux%2Ffrood'}],
+ ) {
+ my $path = '/chained/roundtrip_urifor/' .
+ $thing->[0] . '/' . $thing->[1];
+ $path .= '?' . join('&',
+ map { $_ .'='. $thing->[2]->{$_}}
+ sort keys %{$thing->[2]}) if $thing->[2];
+ ok( my $content =
+ get('http://localhost/' . $path),
+ 'request ' . $path . ' ok');
+ # Just check that the path matches, as who the hell knows or cares
+ # where the app is based (live tests etc)
+ ok( index($content, $path) > 1, 'uri can round trip through uri_for' );
+ }
}
+done_testing;
+
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_default.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_default.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_default.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -29,7 +29,7 @@
TestApp::Controller::Action::Default->begin
TestApp::Controller::Action::Default->default
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -76,7 +76,7 @@
my @expected = qw[
TestApp::Controller::Action->begin
TestApp::Controller::Action->default
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_detach.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_detach.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_detach.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -30,7 +30,7 @@
TestApp::Controller::Action::Detach->one
TestApp::Controller::Action::Detach->two
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -57,7 +57,7 @@
TestApp::Controller::Action::Detach->path
TestApp::Controller::Action::Detach->two
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_forward.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_forward.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_forward.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -33,7 +33,7 @@
TestApp::Controller::Action::Forward->four
TestApp::Controller::Action::Forward->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -81,7 +81,7 @@
TestApp::Controller::Action::Forward->four
TestApp::Controller::Action::Forward->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -156,7 +156,7 @@
TestApp::Controller::Action::Forward->four
TestApp::Controller::Action::Forward->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -191,7 +191,7 @@
TestApp::Controller::Action::Forward->four
TestApp::Controller::Action::Forward->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_go.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_go.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_go.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -43,7 +43,7 @@
TestApp::Controller::Action::Go->four
TestApp::Controller::Action::Go->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
@@ -74,7 +74,7 @@
my @expected = qw[
TestApp::Controller::Action::Go->go_die
TestApp::Controller::Action::Go->args
- TestApp->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
@@ -165,7 +165,7 @@
TestApp::Controller::Action::Go->four
TestApp::Controller::Action::Go->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
@@ -200,7 +200,7 @@
TestApp::Controller::Action::Go->four
TestApp::Controller::Action::Go->five
TestApp::View::Dump::Request->process
- TestApp->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
@@ -262,7 +262,7 @@
ok( my $response = request('http://localhost/action/go/go_chained'), 'go to chained + subcontroller endpoint' );
is( $response->header('X-Catalyst-Executed'),
$expected, 'Executed actions' );
- is( $response->content, 'arg1, arg2; captureme', 'Content OK' );
+ is( $response->content, 'captureme; arg1, arg2', 'Content OK' );
}
}
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_index.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_index.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_index.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -27,8 +27,8 @@
# test root index
{
my @expected = qw[
- TestApp->index
- TestApp->end
+ TestApp::Controller::Root->index
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -45,7 +45,7 @@
{
my @expected = qw[
TestApp::Controller::Index->index
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -66,7 +66,7 @@
my @expected = qw[
TestApp::Controller::Action::Index->begin
TestApp::Controller::Action::Index->index
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -87,7 +87,7 @@
my @expected = qw[
TestApp::Controller::Action::Index->begin
TestApp::Controller::Action::Index->default
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_index_or_default.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_index_or_default.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_index_or_default.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -10,10 +10,13 @@
BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 6*$iters;
-
+use Test::More;
use Catalyst::Test 'TestAppIndexDefault';
+plan 'skip_all' if ( $ENV{CATALYST_SERVER} );
+
+plan tests => 6*$iters;
+
if ( $ENV{CAT_BENCHMARK} ) {
require Benchmark;
Benchmark::timethis( $iters, \&run_tests );
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_path_matchsingle.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_path_matchsingle.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_path_matchsingle.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -10,9 +10,13 @@
BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 3*$iters;
+use Test::More;
use Catalyst::Test 'TestAppMatchSingleArg';
+plan 'skip_all' if ( $ENV{CATALYST_SERVER} );
+
+plan tests => 3*$iters;
+
if ( $ENV{CAT_BENCHMARK} ) {
require Benchmark;
Benchmark::timethis( $iters, \&run_tests );
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_regexp.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_regexp.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_regexp.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -131,8 +131,10 @@
'TestApp::Controller::Action::Regexp',
'Test Class'
);
+ my $location = $response->header('location');
+ $location =~ s/localhost(:\d+)?/localhost/;
is(
- $response->header('location'),
+ $location,
$url,
'Redirect URI is the same as the request URI'
);
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_streaming.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_streaming.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_streaming.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -10,7 +10,7 @@
BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 10*$iters;
+use Test::More tests => 15*$iters;
use Catalyst::Test 'TestApp';
if ( $ENV{CAT_BENCHMARK} ) {
@@ -69,4 +69,14 @@
is( $response->content_length, -s $file, 'Response Content-Length' );
is( $response->content, $buffer, 'Content is read from filehandle' );
}
+
+ {
+ my $size = 128 * 1024; # more than one read with the default chunksize
+
+ ok( my $response = request('http://localhost/action/streaming/body_large'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->content_length, $size, 'Response Content-Length' );
+ is( $response->content, "\0" x $size, 'Content is read from filehandle' );
+ }
}
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_visit.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_visit.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_action_visit.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -42,11 +42,11 @@
TestApp::Controller::Action::Visit->four
TestApp::Controller::Action::Visit->five
TestApp::View::Dump::Request->process
- TestApp->end
- TestApp->end
- TestApp->end
- TestApp->end
- TestApp->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
@@ -76,8 +76,8 @@
my @expected = qw[
TestApp::Controller::Action::Visit->visit_die
TestApp::Controller::Action::Visit->args
- TestApp->end
- TestApp->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
@@ -166,12 +166,12 @@
TestApp::Controller::Action::Visit->four
TestApp::Controller::Action::Visit->five
TestApp::View::Dump::Request->process
- TestApp->end
- TestApp->end
- TestApp->end
- TestApp->end
- TestApp->end
- TestApp->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
@@ -206,12 +206,12 @@
TestApp::Controller::Action::Visit->four
TestApp::Controller::Action::Visit->five
TestApp::View::Dump::Request->process
- TestApp->end
- TestApp->end
- TestApp->end
- TestApp->end
- TestApp->end
- TestApp->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
+ TestApp::Controller::Root->end
];
@expected = map { /Action/ ? (_begin($_), $_) : ($_) } @expected;
@@ -266,7 +266,7 @@
TestApp::Controller::Action::Chained->foo
TestApp::Controller::Action::Chained::Foo->spoon
TestApp::Controller::Action::Chained->end
- TestApp->end
+ TestApp::Controller::Root->end
];
my $expected = join( ", ", @expected );
@@ -276,7 +276,7 @@
"visit to chained + subcontroller endpoint for $i" );
is( $response->header('X-Catalyst-Executed'),
$expected, "Executed actions for $i" );
- is( $response->content, "arg1, arg2; becomescapture",
+ is( $response->content, "becomescapture; arg1, arg2",
"Content OK for $i" );
}
}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_anon.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_anon.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_anon.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_anon.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,24 @@
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 6;
+use Catalyst::Test 'TestApp';
+
+{
+ my $response = request('http://localhost/anon/test');
+ ok($response->is_success);
+ is($response->header('X-Component-Name-Action'),
+ 'TestApp::Controller::Anon', 'Action can see correct catalyst_component_name');
+ isnt($response->header('X-Component-Instance-Name-Action'),
+ 'TestApp::Controller::Anon', 'ref($controller) ne catalyst_component_name');
+ is($response->header('X-Component-Name-Controller'),
+ 'TestApp::Controller::Anon', 'Controller can see correct catalyst_component_name');
+ is($response->header('X-Class-In-Action'),
+ 'TestApp::Controller::Anon', '$action->class is catalyst_component_name');
+ is($response->header('X-Anon-Trait-Applied'),
+ '1', 'Anon controller class has trait applied correctly');
+}
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_attributes.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/live_component_controller_attributes.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_attributes.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_controller_attributes.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,19 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 4;
+use Catalyst::Test 'TestApp';
+
+ok( my $response = request('http://localhost/attributes/view'),
+ 'get /attributes/view' );
+ok( !$response->is_success, 'Response Unsuccessful' );
+
+ok( $response = request('http://localhost/attributes/foo'),
+ "get /attributes/foo" );
+
+ok( $response->is_success, "Response OK" );
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_view_single.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_view_single.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_component_view_single.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -10,9 +10,13 @@
BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 3*$iters;
+use Test::More;
use Catalyst::Test 'TestAppOneView';
+plan 'skip_all' if ( $ENV{CATALYST_SERVER} );
+
+plan tests => 3*$iters;
+
if ( $ENV{CAT_BENCHMARK} ) {
require Benchmark;
Benchmark::timethis( $iters, \&run_tests );
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_engine_request_body.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_engine_request_body.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_engine_request_body.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -80,13 +80,13 @@
# 5.80 regression, see note in Catalyst::Plugin::Test::Plugin
{
my $request = GET(
- 'http://localhost/have_req_body_in_prepare_action',
+ 'http://localhost/dump/response',
'Content-Type' => 'text/plain',
'Content' => 'x' x 100_000
);
ok( my $response = request($request), 'Request' );
ok( $response->is_success, 'Response Successful 2xx' );
- like( $response->content, qr/^[1-9]/, 'Has body' );
+ ok( $response->header('X-Have-Request-Body'), 'X-Have-Request-Body set' );
}
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_engine_request_escaped_path.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_engine_request_escaped_path.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_engine_request_escaped_path.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -54,8 +54,6 @@
}
# test that request with URL-escaped code works.
-TODO: {
- local $TODO = 'Actions should match when path parts are url encoded';
my $request = Catalyst::Utils::request( 'http://localhost/args/param%73/one/two' );
my $cgi = HTTP::Request::AsCGI->new( $request, %ENV )->setup;
@@ -67,6 +65,8 @@
TestApp->handle_request( env => \%ENV );
ok( my $response = $cgi->restore->response );
+TODO: {
+ local $TODO = 'Actions should match when path parts are url encoded';
ok( $response->is_success, 'Response Successful 2xx' );
is( $response->content, 'onetwo' );
}
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_engine_request_headers.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_engine_request_headers.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_engine_request_headers.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -6,7 +6,7 @@
use FindBin;
use lib "$FindBin::Bin/../lib";
-use Test::More tests => 17;
+use Test::More tests => 18;
use Catalyst::Test 'TestApp';
use Catalyst::Request;
@@ -22,6 +22,7 @@
'X-Multiple' => [ 1 .. 5 ],
'X-Forwarded-Host' => 'frontend.server.com',
'X-Forwarded-For' => '192.168.1.1, 1.2.3.4',
+ 'X-Forwarded-Port' => 443
);
ok( my $response = request($request), 'Request' );
@@ -30,6 +31,7 @@
like( $response->content, qr/^bless\( .* 'Catalyst::Request' \)$/s, 'Content is a serialized Catalyst::Request' );
ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
isa_ok( $creq, 'Catalyst::Request' );
+ ok( $creq->secure, 'Forwarded port sets securet' );
isa_ok( $creq->headers, 'HTTP::Headers', 'Catalyst::Request->headers' );
is( $creq->header('X-Whats-Cool'), $request->header('X-Whats-Cool'), 'Catalyst::Request->header X-Whats-Cool' );
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_engine_request_remote_user.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_engine_request_remote_user.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/live_engine_request_remote_user.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -37,6 +37,11 @@
}
isa_ok( $creq, 'Catalyst::Request' );
-
- is( $creq->remote_user, 'dwc', '$c->req->remote_user ok' );
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip 'Using remote server', 1;
+ }
+ is( $creq->remote_user, 'dwc', '$c->req->remote_user ok' );
+ }
}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/meta_method_unneeded.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/meta_method_unneeded.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/meta_method_unneeded.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/meta_method_unneeded.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,20 @@
+use strict;
+use warnings;
+use FindBin qw/$Bin/;
+use lib "$Bin/../lib";
+use Test::More tests => 1;
+use Test::Exception;
+use Carp ();
+
+# Doing various silly things, like for example
+# use CGI qw/:standard/ in your conrtoller / app
+# will overwrite your meta method, therefore Catalyst
+# can't depend on it being there correctly.
+
+# This is/was demonstrated by Catalyst::Controller::WrapCGI
+# and Catalyst::Plugin::Cache::Curried
+
+use Catalyst::Test 'TestAppWithMeta';
+
+ok( request('/')->is_success );
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_controller_actions.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_controller_actions.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_controller_actions.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_controller_actions.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,26 @@
+use strict;
+use warnings;
+use Test::More tests => 4;
+
+use Catalyst ();
+{
+ package TestController;
+ use Moose;
+ BEGIN { extends 'Catalyst::Controller' }
+
+ sub action : Local {}
+
+ sub foo : Path {}
+
+ no Moose;
+}
+
+my $mock_app = Class::MOP::Class->create_anon_class( superclasses => ['Catalyst'] );
+my $app = $mock_app->name->new;
+my $controller = TestController->new($app, {actions => { foo => { Path => '/some/path' }}});
+
+ok $controller->can('_controller_actions');
+is_deeply $controller->_controller_actions => { foo => { Path => '/some/path' }};
+is_deeply $controller->{actions} => { foo => { Path => '/some/path' }}; # Back compat.
+is_deeply [ sort grep { ! /^_/ } map { $_->name } $controller->get_action_methods ], [sort qw/action foo/];
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_controller_config.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_controller_config.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_controller_config.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_controller_config.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,91 @@
+## ============================================================================
+## Test to make sure that subclassed controllers (catalyst controllers
+## that inherit from a custom base catalyst controller) don't experienc
+## any namespace collision in the values under config.
+## ============================================================================
+
+use Test::More tests => 9;
+
+use strict;
+use warnings;
+
+use_ok('Catalyst');
+
+## ----------------------------------------------------------------------------
+## First We define a base controller that inherits from Catalyst::Controller
+## We add something to the config that we expect all children classes to
+## be able to find.
+## ----------------------------------------------------------------------------
+
+{
+ package base_controller;
+
+ use base 'Catalyst::Controller';
+
+ __PACKAGE__->config( base_key => 'base_value' );
+}
+
+## ----------------------------------------------------------------------------
+## Next we instantiate two classes that inherit from the base controller. We
+## Add some local config information to these.
+## ----------------------------------------------------------------------------
+
+{
+ package controller_a;
+
+ use base 'base_controller';
+
+ __PACKAGE__->config( key_a => 'value_a' );
+}
+
+
+{
+ package controller_b;
+
+ use base 'base_controller';
+
+ __PACKAGE__->config->{key_b} = 'value_b';
+}
+
+## Okay, we expect that the base controller has a config with one key
+## and that the two children controllers inherit that config key and then
+## add one more. So the base controller has one config value and the two
+## children each have two.
+
+## ----------------------------------------------------------------------------
+## THE TESTS. Basically we first check to make sure that all the children of
+## the base_controller properly inherit the {base_key => 'base_value'} info
+## and that each of the children also has its local config data and that none
+## of the classes have data that is unexpected.
+## ----------------------------------------------------------------------------
+
+
+# First round, does everything have what we expect to find? If these tests fail there is something
+# wrong with the way config is storing its information.
+
+ok( base_controller->config->{base_key} eq 'base_value', 'base_controller has expected config value for "base_key"') or
+ diag('"base_key" defined as "'.base_controller->config->{base_key}.'" and not "base_value" in config');
+
+ok( controller_a->config->{base_key} eq 'base_value', 'controller_a has expected config value for "base_key"') or
+ diag('"base_key" defined as "'.controller_a->config->{base_key}.'" and not "base_value" in config');
+
+ok( controller_a->config->{key_a} eq 'value_a', 'controller_a has expected config value for "key_a"') or
+ diag('"key_a" defined as "'.controller_a->config->{key_a}.'" and not "value_a" in config');
+
+ok( controller_b->config->{base_key} eq 'base_value', 'controller_b has expected config value for "base_key"') or
+ diag('"base_key" defined as "'.controller_b->config->{base_key}.'" and not "base_value" in config');
+
+ok( controller_b->config->{key_b} eq 'value_b', 'controller_b has expected config value for "key_b"') or
+ diag('"key_b" defined as "'.controller_b->config->{key_b}.'" and not "value_b" in config');
+
+# second round, does each controller have the expected number of config values? If this test fails there is
+# probably some data collision between the controllers.
+
+ok( scalar(keys %{base_controller->config}) == 1, 'base_controller has the expected number of config values') or
+ diag("base_controller should have 1 config value, but it has ".scalar(keys %{base_controller->config}));
+
+ok( scalar(keys %{controller_a->config}) == 2, 'controller_a has the expected number of config values') or
+ diag("controller_a should have 2 config value, but it has ".scalar(keys %{base_controller->config}));
+
+ok( scalar(keys %{controller_b->config}) == 2, 'controller_b has the expected number of config values') or
+ diag("controller_a should have 2 config value, but it has ".scalar(keys %{base_controller->config}));
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_controller_namespace.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_controller_namespace.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_controller_namespace.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_controller_namespace.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,24 @@
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+
+BEGIN {
+ package MyApp::Controller::Foo;
+
+ use base qw/Catalyst::Controller/;
+
+ package MyApp::Controller::Root;
+
+ use base qw/Catalyst::Controller/;
+
+ __PACKAGE__->config(namespace => '');
+
+ package Stub;
+
+ sub config { {} };
+}
+
+is(MyApp::Controller::Foo->action_namespace('Stub'), 'foo');
+
+is(MyApp::Controller::Root->action_namespace('Stub'), '');
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_action.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_action.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_action.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_action.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,54 @@
+use Test::More tests => 6;
+use strict;
+use warnings;
+use Moose::Meta::Class;
+#use Moose::Meta::Attribute;
+use Catalyst::Request;
+
+use_ok('Catalyst::Action');
+
+my $action_1 = Catalyst::Action->new(
+ name => 'foo',
+ code => sub { "DUMMY" },
+ reverse => 'bar/foo',
+ namespace => 'bar',
+ attributes => {
+ Args => [ 1 ],
+ attr2 => [ 2 ],
+ },
+);
+
+my $action_2 = Catalyst::Action->new(
+ name => 'foo',
+ code => sub { "DUMMY" },
+ reverse => 'bar/foo',
+ namespace => 'bar',
+ attributes => {
+ Args => [ 2 ],
+ attr2 => [ 2 ],
+ },
+);
+
+is("${action_1}", $action_1->reverse, 'overload string');
+is($action_1->(), 'DUMMY', 'overload code');
+
+my $anon_meta = Moose::Meta::Class->create_anon_class(
+ attributes => [
+ Moose::Meta::Attribute->new(
+ request => (
+ reader => 'request',
+ required => 1,
+ default => sub { Catalyst::Request->new(arguments => [qw/one two/]) },
+ ),
+ ),
+ ],
+ methods => { req => sub { shift->request(@_) } }
+);
+
+my $mock_c = $anon_meta->new_object();
+$mock_c->request;
+
+ok(!$action_1->match($mock_c), 'bad match fails');
+ok($action_2->match($mock_c), 'good match works');
+
+ok($action_2->compare( $action_1 ), 'compare works');
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_action_for.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_action_for.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_action_for.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -12,7 +12,7 @@
use_ok('TestApp');
-is(TestApp->action_for('global_action')->code, TestApp->can('global_action'),
+is(TestApp->action_for('global_action')->code, TestApp::Controller::Root->can('global_action'),
'action_for on appclass ok');
is(TestApp->controller('Args')->action_for('args')->code,
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_classdata.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_classdata.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_classdata.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_classdata.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,106 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Scalar::Util qw/refaddr blessed/;
+use Test::More tests => 37;
+
+{
+ package ClassDataTest;
+ use Moose;
+ with 'Catalyst::ClassData';
+
+ package ClassDataTest2;
+ use Moose;
+ extends 'ClassDataTest';
+
+}
+
+ my $scalar = '100';
+ my $arrayref = [];
+ my $hashref = {};
+ my $scalarref = \$scalar;
+ my $coderef = sub { "beep" };
+
+ my $scalar2 = '200';
+ my $arrayref2 = [];
+ my $hashref2 = {};
+ my $scalarref2 = \$scalar2;
+ my $coderef2 = sub { "beep" };
+
+ my $scalar3 = '300';
+ my $arrayref3 = [];
+ my $hashref3 = {};
+ my $scalarref3 = \$scalar3;
+ my $coderef3 = sub { "beep" };
+
+
+my @accessors = qw/_arrayref _hashref _scalarref _coderef _scalar/;
+ClassDataTest->mk_classdata($_) for @accessors;
+can_ok('ClassDataTest', @accessors);
+
+ClassDataTest2->mk_classdata("beep", "meep");
+is(ClassDataTest2->beep, "meep");
+
+ClassDataTest->_arrayref($arrayref);
+ClassDataTest->_hashref($hashref);
+ClassDataTest->_scalarref($scalarref);
+ClassDataTest->_coderef($coderef);
+ClassDataTest->_scalar($scalar);
+
+is(ref(ClassDataTest->_arrayref), 'ARRAY');
+is(ref(ClassDataTest->_hashref), 'HASH');
+is(ref(ClassDataTest->_scalarref), 'SCALAR');
+is(ref(ClassDataTest->_coderef), 'CODE');
+ok( !ref(ClassDataTest->_scalar) );
+is(refaddr(ClassDataTest->_arrayref), refaddr($arrayref));
+is(refaddr(ClassDataTest->_hashref), refaddr($hashref));
+is(refaddr(ClassDataTest->_scalarref), refaddr($scalarref));
+is(refaddr(ClassDataTest->_coderef), refaddr($coderef));
+is(ClassDataTest->_scalar, $scalar);
+
+
+is(ref(ClassDataTest2->_arrayref), 'ARRAY');
+is(ref(ClassDataTest2->_hashref), 'HASH');
+is(ref(ClassDataTest2->_scalarref), 'SCALAR');
+is(ref(ClassDataTest2->_coderef), 'CODE');
+ok( !ref(ClassDataTest2->_scalar) );
+is(refaddr(ClassDataTest2->_arrayref), refaddr($arrayref));
+is(refaddr(ClassDataTest2->_hashref), refaddr($hashref));
+is(refaddr(ClassDataTest2->_scalarref), refaddr($scalarref));
+is(refaddr(ClassDataTest2->_coderef), refaddr($coderef));
+is(ClassDataTest2->_scalar, $scalar);
+
+ClassDataTest2->_arrayref($arrayref2);
+ClassDataTest2->_hashref($hashref2);
+ClassDataTest2->_scalarref($scalarref2);
+ClassDataTest2->_coderef($coderef2);
+ClassDataTest2->_scalar($scalar2);
+
+is(refaddr(ClassDataTest2->_arrayref), refaddr($arrayref2));
+is(refaddr(ClassDataTest2->_hashref), refaddr($hashref2));
+is(refaddr(ClassDataTest2->_scalarref), refaddr($scalarref2));
+is(refaddr(ClassDataTest2->_coderef), refaddr($coderef2));
+is(ClassDataTest2->_scalar, $scalar2);
+
+is(refaddr(ClassDataTest->_arrayref), refaddr($arrayref));
+is(refaddr(ClassDataTest->_hashref), refaddr($hashref));
+is(refaddr(ClassDataTest->_scalarref), refaddr($scalarref));
+is(refaddr(ClassDataTest->_coderef), refaddr($coderef));
+is(ClassDataTest->_scalar, $scalar);
+
+ClassDataTest->_arrayref($arrayref3);
+ClassDataTest->_hashref($hashref3);
+ClassDataTest->_scalarref($scalarref3);
+ClassDataTest->_coderef($coderef3);
+ClassDataTest->_scalar($scalar3);
+
+is(refaddr(ClassDataTest->_arrayref), refaddr($arrayref3));
+is(refaddr(ClassDataTest->_hashref), refaddr($hashref3));
+is(refaddr(ClassDataTest->_scalarref), refaddr($scalarref3));
+is(refaddr(ClassDataTest->_coderef), refaddr($coderef3));
+is(ClassDataTest->_scalar, $scalar3);
+
+my $i = bless {}, 'ClassDataTest';
+$i->_scalar('foo');
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_component.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_component.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_component.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_component.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,93 @@
+use Test::More tests => 22;
+use strict;
+use warnings;
+
+use_ok('Catalyst');
+
+my @complist = map { "MyApp::$_"; } qw/C::Controller M::Model V::View/;
+
+{
+ package MyApp;
+
+ 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');
+
+is(MyApp->comp('C::Controller'), 'MyApp::C::Controller', 'Two-part return ok');
+
+is(MyApp->comp('Model'), 'MyApp::M::Model', 'Single part return ok');
+
+is_deeply([ MyApp->comp() ], \@complist, 'Empty return ok');
+
+# Is this desired behaviour?
+is_deeply([ MyApp->comp('Foo') ], \@complist, 'Fallthrough return ok');
+
+# 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 = sort qw( MyApp::C::Controller MyApp::M::Model );
+ my @got = sort MyApp->comp( qr{::[MC]::} );
+ is_deeply( \@got, \@expected, 'multiple results from 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 'once';
+ *MyApp::M::Model::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args};
+ }
+
+ my $c = bless {}, 'MyApp';
+
+ $c->component('MyApp::M::Model', qw/foo bar/);
+ is_deeply($args, [qw/foo bar/], 'args passed to ACCEPT_CONTEXT ok');
+
+ $c->component('M::Model', qw/foo2 bar2/);
+ is_deeply($args, [qw/foo2 bar2/], 'args passed to ACCEPT_CONTEXT ok');
+
+ $c->component('Mode', qw/foo3 bar3/);
+ is_deeply($args, [qw/foo3 bar3/], 'args passed to ACCEPT_CONTEXT ok');
+}
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_component_loading.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_component_loading.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_component_loading.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_component_loading.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,235 @@
+# 2 initial tests, and 6 per component in the loop below
+# (do not forget to update the number of components in test 3 as well)
+# 5 extra tests for the loading options
+# One test for components in inner packages
+use Test::More tests => 2 + 6 * 24 + 8 + 1;
+
+use strict;
+use warnings;
+
+use File::Spec;
+use File::Path;
+
+my $libdir = 'test_trash';
+local @INC = @INC;
+unshift(@INC, $libdir);
+
+my $appclass = 'TestComponents';
+my @components = (
+ { type => 'Controller', prefix => 'C', name => 'Bar' },
+ { type => 'Controller', prefix => 'C', name => 'Foo::Bar' },
+ { type => 'Controller', prefix => 'C', name => 'Foo::Foo::Bar' },
+ { type => 'Controller', prefix => 'C', name => 'Foo::Foo::Foo::Bar' },
+ { type => 'Controller', prefix => 'Controller', name => 'Bar::Bar::Bar::Foo' },
+ { type => 'Controller', prefix => 'Controller', name => 'Bar::Bar::Foo' },
+ { type => 'Controller', prefix => 'Controller', name => 'Bar::Foo' },
+ { type => 'Controller', prefix => 'Controller', name => 'Foo' },
+ { type => 'Model', prefix => 'M', name => 'Bar' },
+ { type => 'Model', prefix => 'M', name => 'Foo::Bar' },
+ { type => 'Model', prefix => 'M', name => 'Foo::Foo::Bar' },
+ { type => 'Model', prefix => 'M', name => 'Foo::Foo::Foo::Bar' },
+ { type => 'Model', prefix => 'Model', name => 'Bar::Bar::Bar::Foo' },
+ { type => 'Model', prefix => 'Model', name => 'Bar::Bar::Foo' },
+ { type => 'Model', prefix => 'Model', name => 'Bar::Foo' },
+ { type => 'Model', prefix => 'Model', name => 'Foo' },
+ { type => 'View', prefix => 'V', name => 'Bar' },
+ { type => 'View', prefix => 'V', name => 'Foo::Bar' },
+ { type => 'View', prefix => 'V', name => 'Foo::Foo::Bar' },
+ { type => 'View', prefix => 'V', name => 'Foo::Foo::Foo::Bar' },
+ { type => 'View', prefix => 'View', name => 'Bar::Bar::Bar::Foo' },
+ { type => 'View', prefix => 'View', name => 'Bar::Bar::Foo' },
+ { type => 'View', prefix => 'View', name => 'Bar::Foo' },
+ { type => 'View', prefix => 'View', name => 'Foo' },
+);
+
+sub write_component_file {
+ my ($dir_list, $module_name, $content) = @_;
+
+ my $dir = File::Spec->catdir(@$dir_list);
+ my $file = File::Spec->catfile($dir, $module_name . '.pm');
+
+ mkpath(join(q{/}, @$dir_list) );
+ open(my $fh, '>', $file) or die "Could not open file $file for writing: $!";
+ print $fh $content;
+ close $fh;
+}
+
+sub make_component_file {
+ my ($libdir, $appclass, $type, $prefix, $name) = @_;
+
+ my $compbase = "Catalyst::${type}";
+ my $fullname = "${appclass}::${prefix}::${name}";
+ my @namedirs = split(/::/, $name);
+ my $name_final = pop(@namedirs);
+ my @dir_list = ($libdir, $appclass, $prefix, @namedirs);
+
+ write_component_file(\@dir_list, $name_final, <<EOF);
+package $fullname;
+use MRO::Compat;
+use base '$compbase';
+sub COMPONENT {
+ my \$self = shift->next::method(\@_);
+ no strict 'refs';
+ *{\__PACKAGE__ . "::whoami"} = sub { return \__PACKAGE__; };
+ \$self;
+}
+1;
+
+EOF
+}
+
+foreach my $component (@components) {
+ make_component_file(
+ $libdir,
+ $appclass,
+ $component->{type},
+ $component->{prefix},
+ $component->{name},
+ );
+}
+
+my $shut_up_deprecated_warnings = q{
+ __PACKAGE__->log(Catalyst::Log->new('fatal'));
+};
+
+eval "package $appclass; use Catalyst; $shut_up_deprecated_warnings __PACKAGE__->setup";
+
+can_ok( $appclass, 'components');
+
+my $complist = $appclass->components;
+
+# the +1 below is for the app class itself
+is(scalar keys %$complist, 24+1, "Correct number of components loaded");
+
+foreach (keys %$complist) {
+
+ # Skip the component which happens to be the app itself
+ next if $_ eq $appclass;
+
+ my $instance = $appclass->component($_);
+ isa_ok($instance, $_);
+ can_ok($instance, 'whoami');
+ is($instance->whoami, $_);
+
+ if($_ =~ /^${appclass}::(?:V|View)::(.*)/) {
+ my $moniker = $1;
+ isa_ok($instance, 'Catalyst::View');
+ can_ok($appclass->view($moniker), 'whoami');
+ is($appclass->view($moniker)->whoami, $_);
+ }
+ elsif($_ =~ /^${appclass}::(?:M|Model)::(.*)/) {
+ my $moniker = $1;
+ isa_ok($instance, 'Catalyst::Model');
+ can_ok($appclass->model($moniker), 'whoami');
+ is($appclass->model($moniker)->whoami, $_);
+ }
+ elsif($_ =~ /^${appclass}::(?:C|Controller)::(.*)/) {
+ my $moniker = $1;
+ isa_ok($instance, 'Catalyst::Controller');
+ can_ok($appclass->controller($moniker), 'whoami');
+ is($appclass->controller($moniker)->whoami, $_);
+ }
+ else {
+ die "Something is wrong with this test, this should"
+ . " have been unreachable";
+ }
+}
+
+rmtree($libdir);
+
+# test extra component loading options
+
+$appclass = 'ExtraOptions';
+push @components, { type => 'View', prefix => 'Extra', name => 'Foo' };
+
+foreach my $component (@components) {
+ make_component_file(
+ $libdir,
+ $appclass,
+ $component->{type},
+ $component->{prefix},
+ $component->{name},
+ );
+}
+
+eval qq(
+package $appclass;
+use Catalyst;
+$shut_up_deprecated_warnings
+__PACKAGE__->config->{ setup_components } = {
+ search_extra => [ '::Extra' ],
+ except => [ "${appclass}::Controller::Foo" ]
+};
+__PACKAGE__->setup;
+);
+
+can_ok( $appclass, 'components');
+
+$complist = $appclass->components;
+
+is(scalar keys %$complist, 24+1, "Correct number of components loaded");
+
+ok( !exists $complist->{ "${appclass}::Controller::Foo" }, 'Controller::Foo was skipped' );
+ok( exists $complist->{ "${appclass}::Extra::Foo" }, 'Extra::Foo was loaded' );
+
+rmtree($libdir);
+
+$appclass = "ComponentOnce";
+
+write_component_file([$libdir, $appclass, 'Model'], 'TopLevel', <<EOF);
+package ${appclass}::Model::TopLevel;
+use base 'Catalyst::Model';
+sub COMPONENT {
+
+ my \$self = shift->next::method(\@_);
+ no strict 'refs';
+ *{\__PACKAGE__ . "::whoami"} = sub { return \__PACKAGE__; };
+ *${appclass}::Model::TopLevel::GENERATED::ACCEPT_CONTEXT = sub {
+ return bless {}, 'FooBarBazQuux';
+ };
+ \$self;
+}
+
+package ${appclass}::Model::TopLevel::Nested;
+
+sub COMPONENT { die "COMPONENT called in the wrong order!"; }
+
+1;
+
+EOF
+
+write_component_file([$libdir, $appclass, 'Model', 'TopLevel'], 'Nested', <<EOF);
+package ${appclass}::Model::TopLevel::Nested;
+use base 'Catalyst::Model';
+
+my \$called=0;
+no warnings 'redefine';
+sub COMPONENT { \$called++;return shift->next::method(\@_); }
+sub called { return \$called };
+1;
+
+EOF
+
+eval "package $appclass; use Catalyst; __PACKAGE__->setup";
+
+is($@, '', "Didn't load component twice");
+is($appclass->model('TopLevel::Nested')->called,1, 'COMPONENT called once');
+
+ok($appclass->model('TopLevel::Generated'), 'Have generated model');
+is(ref($appclass->model('TopLevel::Generated')), 'FooBarBazQuux',
+ 'ACCEPT_CONTEXT in generated inner package fired as expected');
+
+$appclass = "InnerComponent";
+
+{
+ package InnerComponent::Controller::Test;
+ use base 'Catalyst::Controller';
+}
+
+$INC{'InnerComponent/Controller/Test.pm'} = 1;
+
+eval "package $appclass; use Catalyst; __PACKAGE__->setup";
+
+isa_ok($appclass->controller('Test'), 'Catalyst::Controller');
+
+rmtree($libdir);
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_component_mro.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_component_mro.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_component_mro.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_component_mro.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,29 @@
+use Test::More tests => 1;
+use strict;
+use warnings;
+
+{
+ package MyApp::Component;
+ use Test::More;
+
+ sub COMPONENT {
+ fail 'This no longer gets dispatched to';
+ }
+
+ package MyApp::MyComponent;
+
+ use base 'Catalyst::Component', 'MyApp::Component';
+
+}
+
+my $warn = '';
+{
+ local $SIG{__WARN__} = sub {
+ $warn .= $_[0];
+ };
+ MyApp::MyComponent->COMPONENT('MyApp');
+}
+
+like($warn, qr/after Catalyst::Component in MyApp::Component/,
+ 'correct warning thrown');
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_engine_fixenv-iis6.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_engine_fixenv-iis6.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_engine_fixenv-iis6.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_engine_fixenv-iis6.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,62 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+eval "use FCGI";
+plan skip_all => 'FCGI required' if $@;
+
+plan tests => 2;
+
+require Catalyst::Engine::FastCGI;
+
+my %env = (
+ 'SCRIPT_NAME' => '/koo/blurb',
+ 'PATH_INFO' => '/koo/blurb',
+ 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
+ 'REQUEST_METHOD' => 'GET',
+ 'SCRIPT_FILENAME' => 'C:\\Foo\\script\\blurb',
+ 'INSTANCE_META_PATH' => '/LM/W3SVC/793536',
+ 'SERVER_SOFTWARE' => 'Microsoft-IIS/6.0',
+ 'AUTH_PASSWORD' => '',
+ 'AUTH_TYPE' => '',
+ 'HTTP_USER_AGENT' => 'Mozilla/5.0 (Windows; U; Windows NT 5.2; de; rv:1.9.0.4) Gecko/2008102920 Firefox/3.0.4 (.NET CLR 3.5.30729)',
+ 'REMOTE_PORT' => '1281',
+ 'QUERY_STRING' => '',
+ 'URL' => '/koo/blurb',
+ 'HTTP_ACCEPT_LANGUAGE' => 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3',
+ 'FCGI_ROLE' => 'RESPONDER',
+ 'HTTP_KEEP_ALIVE' => '300',
+ 'CONTENT_TYPE' => '',
+ 'LOCAL_ADDR' => '127.0.0.1',
+ 'GATEWAY_INTERFACE' => 'CGI/1.1',
+ 'HTTPS' => 'off',
+ 'DOCUMENT_ROOT' => 'C:\\Foo\\script',
+ 'REMOTE_HOST' => '127.0.0.1',
+ 'PATH_TRANSLATED' => 'C:\\Foo\\script\\blurb',
+ 'APPL_PHYSICAL_PATH' => 'C:\\Foo\\script\\',
+ 'SERVER_NAME' => '127.0.0.1',
+ 'HTTP_ACCEPT_ENCODING' => 'gzip,deflate',
+ 'HTTP_CONNECTION' => 'keep-alive',
+ 'INSTANCE_ID' => '793536',
+ 'CONTENT_LENGTH' => '0',
+ 'AUTH_USER' => '',
+ 'APPL_MD_PATH' => '/LM/W3SVC/793536/Root/koo',
+ 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
+ 'REMOTE_USER' => '',
+ 'SERVER_PORT_SECURE' => '0',
+ 'SERVER_PORT' => 83,
+ 'REMOTE_ADDR' => '127.0.0.1',
+ 'SERVER_PROTOCOL' => 'HTTP/1.1',
+ 'REQUEST_URI' => '/koo/blurb',
+ 'APP_POOL_ID' => 'DefaultAppPool',
+ 'HTTP_HOST' => '127.0.0.1:83'
+);
+
+Catalyst::Engine::FastCGI->_fix_env(\%env);
+
+is($env{PATH_INFO}, '//blurb', 'check PATH_INFO');
+is($env{SCRIPT_NAME}, '/koo', 'check SCRIPT_NAME');
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_engine_fixenv-lighttpd.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_engine_fixenv-lighttpd.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_engine_fixenv-lighttpd.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_engine_fixenv-lighttpd.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,46 @@
+#!perl
+
+use strict;
+use warnings;
+
+use Test::More;
+
+eval "use FCGI";
+plan skip_all => 'FCGI required' if $@;
+
+plan tests => 2;
+
+require Catalyst::Engine::FastCGI;
+
+my %env = (
+ 'SCRIPT_NAME' => '/bar',
+ 'SERVER_NAME' => 'localhost:8000',
+ 'HTTP_ACCEPT_ENCODING' => 'gzip,deflate',
+ 'HTTP_CONNECTION' => 'keep-alive',
+ 'PATH_INFO' => '',
+ 'HTTP_ACCEPT' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
+ 'REQUEST_METHOD' => 'GET',
+ 'SCRIPT_FILENAME' => '/tmp/Foo/root/bar',
+ 'HTTP_ACCEPT_CHARSET' => 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
+ 'SERVER_SOFTWARE' => 'lighttpd/1.4.15',
+ 'QUERY_STRING' => '',
+ 'REMOTE_PORT' => '22207',
+ 'SERVER_PORT' => 8000,
+ 'REDIRECT_STATUS' => '200',
+ 'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5',
+ 'REMOTE_ADDR' => '127.0.0.1',
+ 'FCGI_ROLE' => 'RESPONDER',
+ 'HTTP_KEEP_ALIVE' => '300',
+ 'SERVER_PROTOCOL' => 'HTTP/1.1',
+ 'REQUEST_URI' => '/bar',
+ 'GATEWAY_INTERFACE' => 'CGI/1.1',
+ 'SERVER_ADDR' => '127.0.0.1',
+ 'DOCUMENT_ROOT' => '/tmp/Foo/root',
+ 'HTTP_HOST' => 'localhost:8000',
+);
+
+Catalyst::Engine::FastCGI->_fix_env(\%env);
+
+is($env{PATH_INFO}, '/bar', 'check PATH_INFO');
+ok(!exists($env{SCRIPT_NAME}), 'check SCRIPT_NAME');
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_log.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_log.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_log.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_log.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,69 @@
+use strict;
+use warnings;
+
+use Test::More tests => 22;
+
+use Catalyst::Log;
+
+local *Catalyst::Log::_send_to_log;
+local our @MESSAGES;
+{
+ no warnings 'redefine';
+ *Catalyst::Log::_send_to_log = sub {
+ my $self = shift;
+ push @MESSAGES, @_;
+ };
+}
+
+my $LOG = 'Catalyst::Log';
+
+can_ok $LOG, 'new';
+ok my $log = $LOG->new, '... and creating a new log object should succeed';
+isa_ok $log, $LOG, '... and the object it returns';
+
+can_ok $log, 'is_info';
+ok $log->is_info, '... and the default behavior is to allow info messages';
+
+can_ok $log, 'info';
+ok $log->info('hello there!'),
+ '... passing it an info message should succeed';
+
+can_ok $log, "_flush";
+$log->_flush;
+ok @MESSAGES, '... and flushing the log should succeed';
+is scalar @MESSAGES, 1, '... with one log message';
+like $MESSAGES[0], qr/^\[info\] hello there!$/,
+ '... which should match the format we expect';
+
+{
+
+ package Catalyst::Log::Subclass;
+ use base qw/Catalyst::Log/;
+
+ sub _send_to_log {
+ my $self = shift;
+ push @MESSAGES, '---';
+ push @MESSAGES, @_;
+ }
+}
+
+my $SUBCLASS = 'Catalyst::Log::Subclass';
+can_ok $SUBCLASS, 'new';
+ok $log = Catalyst::Log::Subclass->new,
+ '... and the log subclass constructor shoudl return a new object';
+isa_ok $log, $SUBCLASS, '... and the object it returns';
+isa_ok $log, $LOG, '... and it also';
+
+can_ok $log, 'info';
+ok $log->info('hi there!'),
+ '... passing it an info message should succeed';
+
+can_ok $log, "_flush";
+ at MESSAGES = (); # clear the message log
+$log->_flush;
+ok @MESSAGES, '... and flushing the log should succeed';
+is scalar @MESSAGES, 2, '... with two log messages';
+is $MESSAGES[0], '---', '... with the first one being our new data';
+like $MESSAGES[1], qr/^\[info\] hi there!$/,
+ '... which should match the format we expect';
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_merge_config_hashes.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_merge_config_hashes.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_merge_config_hashes.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_merge_config_hashes.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,43 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+my @tests = (
+ {
+ given => [ { a => 1 }, { b => 1 } ],
+ expects => { a => 1, b => 1 }
+ },
+ {
+ given => [ { a => 1 }, { a => { b => 1 } } ],
+ expects => { a => { b => 1 } }
+ },
+ {
+ given => [ { a => { b => 1 } }, { a => 1 } ],
+ expects => { a => 1 }
+ },
+ {
+ given => [ { a => 1 }, { a => [ 1 ] } ],
+ expects => { a => [ 1 ] }
+ },
+ {
+ given => [ { a => [ 1 ] }, { a => 1 } ],
+ expects => { a => 1 }
+ },
+ {
+ given => [ { a => { b => 1 } }, { a => { b => 2 } } ],
+ expects => { a => { b => 2 } }
+ },
+ {
+ given => [ { a => { b => 1 } }, { a => { c => 1 } } ],
+ expects => { a => { b => 1, c => 1 } }
+ },
+);
+
+plan tests => scalar @tests;
+
+use Catalyst::Component;
+
+for my $test ( @ tests ) {
+ is_deeply( Catalyst::Component->merge_config_hashes( @{ $test->{ given } } ), $test->{ expects } );
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_mvc.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_mvc.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_mvc.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_mvc.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,227 @@
+use Test::More tests => 51;
+use strict;
+use warnings;
+
+use_ok('Catalyst');
+
+my @complist =
+ map { "MyMVCTestApp::$_"; }
+ qw/C::Controller M::Model V::View Controller::C Model::M View::V Controller::Model::Dummy::Model Model::Dummy::Model/;
+
+{
+
+ package MyMVCTestApp;
+
+ use base qw/Catalyst/;
+
+ __PACKAGE__->components( { map { ( ref($_)||$_ , $_ ) } @complist } );
+
+ my $thingie={};
+ bless $thingie, 'Some::Test::Object';
+ __PACKAGE__->components->{'MyMVCTestApp::Model::Test::Object'} = $thingie;
+
+ # allow $c->log->warn to work
+ __PACKAGE__->setup_log;
+}
+
+is( MyMVCTestApp->view('View'), 'MyMVCTestApp::V::View', 'V::View ok' );
+
+is( MyMVCTestApp->controller('Controller'),
+ 'MyMVCTestApp::C::Controller', 'C::Controller ok' );
+
+is( MyMVCTestApp->model('Model'), 'MyMVCTestApp::M::Model', 'M::Model ok' );
+
+is( MyMVCTestApp->model('Dummy::Model'), 'MyMVCTestApp::Model::Dummy::Model', 'Model::Dummy::Model ok' );
+
+isa_ok( MyMVCTestApp->model('Test::Object'), 'Some::Test::Object', 'Test::Object ok' );
+
+is( MyMVCTestApp->controller('Model::Dummy::Model'), 'MyMVCTestApp::Controller::Model::Dummy::Model', 'Controller::Model::Dummy::Model ok' );
+
+is( MyMVCTestApp->view('V'), 'MyMVCTestApp::View::V', 'View::V ok' );
+
+is( MyMVCTestApp->controller('C'), 'MyMVCTestApp::Controller::C', 'Controller::C ok' );
+
+is( MyMVCTestApp->model('M'), 'MyMVCTestApp::Model::M', 'Model::M ok' );
+
+# failed search
+{
+ is( MyMVCTestApp->model('DNE'), undef, 'undef for invalid search' );
+}
+
+is_deeply( [ sort MyMVCTestApp->views ],
+ [ qw/V View/ ],
+ 'views ok' );
+
+is_deeply( [ sort MyMVCTestApp->controllers ],
+ [ qw/C Controller Model::Dummy::Model/ ],
+ 'controllers ok');
+
+is_deeply( [ sort MyMVCTestApp->models ],
+ [ qw/Dummy::Model M Model Test::Object/ ],
+ 'models ok');
+
+{
+ my $warnings = 0;
+ no warnings 'redefine';
+ local *Catalyst::Log::warn = sub { $warnings++ };
+
+ like (MyMVCTestApp->view , qr/^MyMVCTestApp\::(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'}}, 'MyMVCTestApp')->view , 'MyMVCTestApp::View::V', 'current_view ok');
+
+my $view = bless {} , 'MyMVCTestApp::View::V';
+is ( bless ({stash=>{current_view_instance=> $view }}, 'MyMVCTestApp')->view , $view, 'current_view_instance ok');
+
+is ( bless ({stash=>{current_view_instance=> $view, current_view=>'MyMVCTestApp::V::View' }}, 'MyMVCTestApp')->view , $view,
+ 'current_view_instance precedes current_view ok');
+
+{
+ my $warnings = 0;
+ no warnings 'redefine';
+ local *Catalyst::Log::warn = sub { $warnings++ };
+
+ ok( my $model = MyMVCTestApp->model );
+
+ ok( (($model =~ /^MyMVCTestApp\::(M|Model)\::/) ||
+ $model->isa('Some::Test::Object')),
+ 'model() with no defaults returns *something*' );
+
+ ok( $warnings, 'model() w/o a default is random, warnings thrown' );
+}
+
+is ( bless ({stash=>{current_model=>'M'}}, 'MyMVCTestApp')->model , 'MyMVCTestApp::Model::M', 'current_model ok');
+
+my $model = bless {} , 'MyMVCTestApp::Model::M';
+is ( bless ({stash=>{current_model_instance=> $model }}, 'MyMVCTestApp')->model , $model, 'current_model_instance ok');
+
+is ( bless ({stash=>{current_model_instance=> $model, current_model=>'MyMVCTestApp::M::Model' }}, 'MyMVCTestApp')->model , $model,
+ 'current_model_instance precedes current_model ok');
+
+MyMVCTestApp->config->{default_view} = 'V';
+is ( bless ({stash=>{}}, 'MyMVCTestApp')->view , 'MyMVCTestApp::View::V', 'default_view ok');
+is ( MyMVCTestApp->view , 'MyMVCTestApp::View::V', 'default_view in class method ok');
+
+MyMVCTestApp->config->{default_model} = 'M';
+is ( bless ({stash=>{}}, 'MyMVCTestApp')->model , 'MyMVCTestApp::Model::M', 'default_model ok');
+is ( MyMVCTestApp->model , 'MyMVCTestApp::Model::M', 'default_model in class method ok');
+
+# regexp behavior tests
+{
+ # is_deeply is used because regexp behavior means list context
+ is_deeply( [ MyMVCTestApp->view( qr{^V[ie]+w$} ) ], [ 'MyMVCTestApp::V::View' ], 'regexp view ok' );
+ is_deeply( [ MyMVCTestApp->controller( qr{Dummy\::Model$} ) ], [ 'MyMVCTestApp::Controller::Model::Dummy::Model' ], 'regexp controller ok' );
+ is_deeply( [ MyMVCTestApp->model( qr{Dum{2}y} ) ], [ 'MyMVCTestApp::Model::Dummy::Model' ], 'regexp model ok' );
+
+ # object w/ qr{}
+ is_deeply( [ MyMVCTestApp->model( qr{Test} ) ], [ MyMVCTestApp->components->{'MyMVCTestApp::Model::Test::Object'} ], 'Object returned' );
+
+ {
+ my $warnings = 0;
+ no warnings 'redefine';
+ local *Catalyst::Log::warn = sub { $warnings++ };
+
+ # object w/ regexp fallback
+ is_deeply( [ MyMVCTestApp->model( 'Test' ) ], [ MyMVCTestApp->components->{'MyMVCTestApp::Model::Test::Object'} ], 'Object returned' );
+ ok( $warnings, 'regexp fallback warnings' );
+ }
+
+ is_deeply( [ MyMVCTestApp->view('MyMVCTestApp::V::View$') ], [ 'MyMVCTestApp::V::View' ], 'Explicit return ok');
+ is_deeply( [ MyMVCTestApp->controller('MyMVCTestApp::C::Controller$') ], [ 'MyMVCTestApp::C::Controller' ], 'Explicit return ok');
+ is_deeply( [ MyMVCTestApp->model('MyMVCTestApp::M::Model$') ], [ 'MyMVCTestApp::M::Model' ], 'Explicit return ok');
+}
+
+{
+ my @expected = qw( MyMVCTestApp::C::Controller MyMVCTestApp::Controller::C );
+ is_deeply( [ sort MyMVCTestApp->controller( qr{^C} ) ], \@expected, 'multiple controller returns from regexp search' );
+}
+
+{
+ my @expected = qw( MyMVCTestApp::V::View MyMVCTestApp::View::V );
+ is_deeply( [ sort MyMVCTestApp->view( qr{^V} ) ], \@expected, 'multiple view returns from regexp search' );
+}
+
+{
+ my @expected = qw( MyMVCTestApp::M::Model MyMVCTestApp::Model::M );
+ is_deeply( [ sort MyMVCTestApp->model( qr{^M} ) ], \@expected, 'multiple model returns from regexp search' );
+}
+
+# failed search
+{
+ is( scalar MyMVCTestApp->controller( qr{DNE} ), 0, '0 results for failed search' );
+}
+
+#checking @args passed to ACCEPT_CONTEXT
+{
+ my $args;
+
+ {
+ no warnings 'once';
+ *MyMVCTestApp::Model::M::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args};
+ *MyMVCTestApp::View::V::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args};
+ }
+
+ my $c = bless {}, 'MyMVCTestApp';
+
+ # test accept-context with class rather than instance
+ MyMVCTestApp->model('M', qw/foo bar/);
+ is_deeply($args, [qw/foo bar/], 'MyMVCTestApp->model args passed to ACCEPT_CONTEXT ok');
+
+
+ $c->model('M', qw/foo bar/);
+ is_deeply($args, [qw/foo bar/], '$c->model args passed to ACCEPT_CONTEXT ok');
+
+ my $x = $c->view('V', qw/foo2 bar2/);
+ is_deeply($args, [qw/foo2 bar2/], '$c->view args passed to ACCEPT_CONTEXT ok');
+
+ # regexp fallback
+ $c->view('::View::V', qw/foo3 bar3/);
+ is_deeply($args, [qw/foo3 bar3/], 'args passed to ACCEPT_CONTEXT ok');
+
+
+}
+
+{
+ my $warn = '';
+ no warnings 'redefine';
+ local *Catalyst::Log::warn = sub { $warn .= $_[1] };
+
+ is_deeply (MyMVCTestApp->controller('MyMVCTestApp::Controller::C'),
+ MyMVCTestApp->components->{'MyMVCTestApp::Controller::C'},
+ 'controller by fully qualified name ok');
+
+ # You probably meant $c->controller('C') instead of $c->controller({'MyMVCTestApp::Controller::C'})
+ my ($suggested_comp_name, $orig_comp_name) = $warn =~ /You probably meant (.*) instead of (.*) /;
+ isnt($suggested_comp_name, $orig_comp_name, 'suggested fix in warning for fully qualified component names makes sense' );
+}
+
+{
+ package MyApp::WithoutRegexFallback;
+
+ use base qw/Catalyst/;
+
+ __PACKAGE__->config( { disable_component_resolution_regex_fallback => 1 } );
+
+ __PACKAGE__->components( { map { ( ref($_)||$_ , $_ ) }
+ qw/MyApp::WithoutRegexFallback::Controller::Another::Foo/ } );
+
+ # allow $c->log->warn to work
+ __PACKAGE__->setup_log;
+}
+
+{
+ # test if non-regex component retrieval still works
+ is( MyApp::WithoutRegexFallback->controller('Another::Foo'),
+ 'MyApp::WithoutRegexFallback::Controller::Another::Foo', 'controller Another::Foo found');
+}
+
+{
+ my $warnings = 0;
+ no warnings 'redefine';
+ local *Catalyst::Log::warn = sub { $warnings++ };
+
+ # try to get nonexisting object w/o regexp fallback
+ is( MyApp::WithoutRegexFallback->controller('Foo'), undef, 'no controller Foo found');
+ ok( !$warnings, 'no regexp fallback warnings' );
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_path_to.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_path_to.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_path_to.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_path_to.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,39 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+my %non_unix = (
+ MacOS => 1,
+ MSWin32 => 1,
+ os2 => 1,
+ VMS => 1,
+ epoc => 1,
+ NetWare => 1,
+ dos => 1,
+ cygwin => 1
+);
+
+my $os = $non_unix{$^O} ? $^O : 'Unix';
+
+if( $os ne 'Unix' ) {
+ plan skip_all => 'tests require Unix';
+}
+else {
+ plan tests => 3;
+}
+
+use_ok('Catalyst');
+
+my $context = 'Catalyst';
+
+my $config = Catalyst->config;
+
+$config->{home} = '/home/sri/my-app/';
+
+is( Catalyst::path_to( $context, 'foo' ), '/home/sri/my-app/foo', 'Unix path' );
+
+$config->{home} = '/Users/sri/myapp/';
+
+is( Catalyst::path_to( $context, 'foo', 'bar' ),
+ '/Users/sri/myapp/foo/bar', 'deep Unix path' );
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_plugin.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_plugin.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_plugin.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_plugin.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,63 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 24;
+
+use lib 't/lib';
+
+{
+
+ package Faux::Plugin;
+
+ sub new { bless { count => 1 }, shift }
+ sub count { shift->{count}++ }
+}
+
+my $warnings = 0;
+
+use PluginTestApp;
+my $logger = Class::MOP::Class->create_anon_class(
+ methods => {
+ error => sub {0},
+ debug => sub {0},
+ info => sub {0},
+ warn => sub {
+ if ($_[1] =~ /plugin method is deprecated/) {
+ $warnings++;
+ return;
+ }
+ die "Caught unexpected warning: " . $_[1];
+ },
+ },
+)->new_object;
+PluginTestApp->log($logger);
+
+use Catalyst::Test qw/PluginTestApp/;
+
+ok( get("/compile_time_plugins"), "get ok" );
+is( $warnings, 0, 'no warnings' );
+# FIXME - Run time plugin support is insane, and should be removed
+# for Catalyst 5.9
+ok( get("/run_time_plugins"), "get ok" );
+
+local $ENV{CATALYST_DEBUG} = 0;
+
+is( $warnings, 1, '1 warning' );
+
+use_ok 'TestApp';
+my @expected = qw(
+ Catalyst::Plugin::Test::Errors
+ Catalyst::Plugin::Test::Headers
+ Catalyst::Plugin::Test::Inline
+ Catalyst::Plugin::Test::MangleDollarUnderScore
+ Catalyst::Plugin::Test::Plugin
+ TestApp::Plugin::AddDispatchTypes
+ TestApp::Plugin::FullyQualified
+);
+
+# Faux::Plugin is no longer reported
+is_deeply [ TestApp->registered_plugins ], \@expected,
+ 'registered_plugins() should only report the plugins for the current class';
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_setup.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_setup.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_setup.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_setup.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,88 @@
+use strict;
+use warnings;
+use Class::MOP::Class;
+use Catalyst::Runtime;
+
+use Test::More tests => 29;
+
+{
+ # Silence the log.
+ my $meta = Catalyst::Log->meta;
+ $meta->make_mutable;
+ $meta->remove_method('_send_to_log');
+ $meta->add_method('_send_to_log', sub {});
+}
+
+sub build_test_app_with_setup {
+ my ($name, @flags) = @_;
+ my $flags = '(' . join(', ', map { "'".$_."'" } @flags) . ')';
+ $flags = '' if $flags eq '()';
+ eval qq{
+ package $name;
+ use Catalyst $flags;
+ $name->setup;
+ };
+ die $@ if $@;
+ return $name;
+}
+
+local %ENV = %ENV;
+
+# Remove all relevant env variables to avoid accidental fail
+foreach my $name (grep { /^(CATALYST|TESTAPP)/ } keys %ENV) {
+ delete $ENV{$name};
+}
+
+{
+ my $app = build_test_app_with_setup('TestAppMyTestDebug', '-Debug');
+
+ ok my $c = $app->new, 'Get debug app object';
+ ok my $log = $c->log, 'Get log object';
+ isa_ok $log, 'Catalyst::Log', 'It should be a Catalyst::Log object';
+ ok $log->is_warn, 'Warnings should be enabled';
+ ok $log->is_error, 'Errors should be enabled';
+ ok $log->is_fatal, 'Fatal errors should be enabled';
+ ok $log->is_info, 'Info should be enabled';
+ ok $log->is_debug, 'Debugging should be enabled';
+ ok $app->debug, 'debug method should return true';
+}
+
+{
+ my $app = build_test_app_with_setup('TestAppMyTestLogParam', '-Log=warn,error,fatal');
+
+ ok my $c = $app->new, 'Get log app object';
+ ok my $log = $c->log, 'Get log object';
+ isa_ok $log, 'Catalyst::Log', 'It should be a Catalyst::Log object';
+ ok $log->is_warn, 'Warnings should be enabled';
+ ok $log->is_error, 'Errors should be enabled';
+ ok $log->is_fatal, 'Fatal errors should be enabled';
+ ok !$log->is_info, 'Info should be disabled';
+ ok !$log->is_debug, 'Debugging should be disabled';
+ ok !$c->debug, 'Catalyst debugging is off';
+}
+{
+ my $app = build_test_app_with_setup('TestAppMyTestNoParams');
+
+ ok my $c = $app->new, 'Get log app object';
+ ok my $log = $c->log, 'Get log object';
+ isa_ok $log, 'Catalyst::Log', 'It should be a Catalyst::Log object';
+ ok $log->is_warn, 'Warnings should be enabled';
+ ok $log->is_error, 'Errors should be enabled';
+ ok $log->is_fatal, 'Fatal errors should be enabled';
+ ok $log->is_info, 'Info should be enabled';
+ ok $log->is_debug, 'Debugging should be enabled';
+ ok !$c->debug, 'Catalyst debugging turned off';
+}
+my $log_meta = Class::MOP::Class->create_anon_class(
+ methods => { map { $_ => sub { 0 } } qw/debug error fatal info warn/ },
+);
+{
+ package TestAppWithOwnLogger;
+ use base qw/Catalyst/;
+ __PACKAGE__->log($log_meta->new_object);
+ __PACKAGE__->setup('-Debug');
+}
+
+ok my $c = TestAppWithOwnLogger->new, 'Get with own logger app object';
+ok $c->debug, '$c->debug is true';
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_setup_log.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_setup_log.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_setup_log.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_setup_log.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,101 @@
+use strict;
+use warnings;
+
+use Test::More tests => 30;
+use Test::Exception;
+
+use Catalyst ();
+
+sub mock_app {
+ my $name = shift;
+ print "Setting up mock application: $name\n";
+ my $meta = Moose->init_meta( for_class => $name );
+ $meta->superclasses('Catalyst');
+ return $meta->name;
+}
+
+sub test_log_object {
+ my ($log, %expected) = @_;
+ foreach my $level (keys %expected) {
+ my $method_name = "is_$level";
+ if ($expected{$level}) {
+ ok( $log->$method_name(), "Level $level on" );
+ }
+ else {
+ ok( !$log->$method_name(), "Level $level off" );
+ }
+ }
+}
+
+local %ENV = %ENV;
+
+# Remove all relevant env variables to avoid accidental fail
+foreach my $name (grep { /^(CATALYST|TESTAPP)/ } keys %ENV) {
+ delete $ENV{$name};
+}
+
+{
+ my $app = mock_app('TestAppParseLogLevels');
+ $app->setup_log('error,warn');
+ ok !$app->debug, 'Not in debug mode';
+ test_log_object($app->log,
+ fatal => 1,
+ error => 1,
+ warn => 1,
+ info => 0,
+ debug => 0,
+ );
+}
+{
+ local %ENV = %ENV;
+ $ENV{CATALYST_DEBUG} = 1;
+ my $app = mock_app('TestAppLogDebugEnvSet');
+ $app->setup_log('');
+ ok $app->debug, 'In debug mode';
+ test_log_object($app->log,
+ fatal => 1,
+ error => 1,
+ warn => 1,
+ info => 1,
+ debug => 1,
+ );
+}
+{
+ local %ENV = %ENV;
+ $ENV{CATALYST_DEBUG} = 0;
+ my $app = mock_app('TestAppLogDebugEnvUnset');
+ $app->setup_log('warn');
+ ok !$app->debug, 'Not In debug mode';
+ test_log_object($app->log,
+ fatal => 1,
+ error => 1,
+ warn => 1,
+ info => 0,
+ debug => 0,
+ );
+}
+{
+ my $app = mock_app('TestAppLogEmptyString');
+ $app->setup_log('');
+ ok !$app->debug, 'Not In debug mode';
+ # Note that by default, you get _all_ the log levels turned on
+ test_log_object($app->log,
+ fatal => 1,
+ error => 1,
+ warn => 1,
+ info => 1,
+ debug => 1,
+ );
+}
+{
+ my $app = mock_app('TestAppLogDebugOnly');
+ $app->setup_log('debug');
+ ok $app->debug, 'In debug mode';
+ test_log_object($app->log,
+ fatal => 1,
+ error => 1,
+ warn => 1,
+ info => 1,
+ debug => 1,
+ );
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_setup_stats.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_setup_stats.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_setup_stats.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_setup_stats.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,70 @@
+use strict;
+use warnings;
+
+use Test::More tests => 5;
+use Class::MOP::Class;
+
+use Catalyst ();
+
+local our %log_messages; # TODO - Test log messages as expected.
+my $mock_log = Class::MOP::Class->create_anon_class(
+ methods => {
+ map { my $level = $_;
+ $level => sub {
+ $log_messages{$level} ||= [];
+ push(@{ $log_messages{$level} }, $_[1]);
+ },
+ }
+ qw/debug info warn error fatal/,
+ },
+)->new_object;
+
+sub mock_app {
+ my $name = shift;
+ my $mock_log = shift;
+ %log_messages = (); # Flatten log messages.
+ my $meta = Moose->init_meta( for_class => $name );
+ $meta->superclasses('Catalyst');
+ $meta->add_method('log', sub { $mock_log });
+ return $meta->name;
+}
+
+local %ENV = %ENV;
+
+# Remove all relevant env variables to avoid accidental fail
+foreach my $name (grep { /^(CATALYST|TESTAPP)/ } keys %ENV) {
+ delete $ENV{$name};
+}
+
+{
+ my $app = mock_app('TestAppNoStats', $mock_log);
+ $app->setup_stats();
+ ok !$app->use_stats, 'stats off by default';
+}
+{
+ my $app = mock_app('TestAppStats', $mock_log);
+ $app->setup_stats(1);
+ ok $app->use_stats, 'stats on if you say >setup_stats(1)';
+}
+{
+ my $app = mock_app('TestAppStatsDebugTurnsStatsOn', $mock_log);
+ $app->meta->add_method('debug' => sub { 1 });
+ $app->setup_stats();
+ ok $app->use_stats, 'debug on turns stats on';
+}
+{
+ local %ENV = %ENV;
+ $ENV{CATALYST_STATS} = 1;
+ my $app = mock_app('TestAppStatsEnvSet', $mock_log);
+ $app->setup_stats();
+ ok $app->use_stats, 'ENV turns stats on';
+}
+{
+ local %ENV = %ENV;
+ $ENV{CATALYST_STATS} = 0;
+ my $app = mock_app('TestAppStatsEnvUnset', $mock_log);
+ $app->meta->add_method('debug' => sub { 1 });
+ $app->setup_stats(1);
+ ok !$app->use_stats, 'ENV turns stats off, even when debug on and ->setup_stats(1)';
+}
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_uri_for.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_for.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_uri_for.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_uri_for.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,145 @@
+use strict;
+use warnings;
+
+use Test::More tests => 20;
+use URI;
+
+use_ok('Catalyst');
+
+my $request = Catalyst::Request->new( {
+ base => URI->new('http://127.0.0.1/foo')
+ } );
+
+my $context = Catalyst->new( {
+ request => $request,
+ namespace => 'yada',
+ } );
+
+is(
+ Catalyst::uri_for( $context, '/bar/baz' )->as_string,
+ 'http://127.0.0.1/foo/bar/baz',
+ 'URI for absolute path'
+);
+
+is(
+ Catalyst::uri_for( $context, 'bar/baz' )->as_string,
+ 'http://127.0.0.1/foo/yada/bar/baz',
+ 'URI for relative path'
+);
+
+is(
+ Catalyst::uri_for( $context, '', 'arg1', 'arg2' )->as_string,
+ 'http://127.0.0.1/foo/yada/arg1/arg2',
+ 'URI for undef action with args'
+);
+
+
+is( Catalyst::uri_for( $context, '../quux' )->as_string,
+ 'http://127.0.0.1/foo/quux', 'URI for relative dot path' );
+
+is(
+ Catalyst::uri_for( $context, 'quux', { param1 => 'value1' } )->as_string,
+ 'http://127.0.0.1/foo/yada/quux?param1=value1',
+ 'URI for undef action with query params'
+);
+
+is (Catalyst::uri_for( $context, '/bar/wibble?' )->as_string,
+ 'http://127.0.0.1/foo/bar/wibble%3F', 'Question Mark gets encoded'
+);
+
+is( Catalyst::uri_for( $context, qw/bar wibble?/, 'with space' )->as_string,
+ 'http://127.0.0.1/foo/yada/bar/wibble%3F/with%20space', 'Space gets encoded'
+);
+
+is(
+ Catalyst::uri_for( $context, '/bar', 'with+plus', { 'also' => 'with+plus' })->as_string,
+ 'http://127.0.0.1/foo/bar/with+plus?also=with%2Bplus',
+ 'Plus is not encoded'
+);
+
+# test with utf-8
+is(
+ Catalyst::uri_for( $context, 'quux', { param1 => "\x{2620}" } )->as_string,
+ 'http://127.0.0.1/foo/yada/quux?param1=%E2%98%A0',
+ 'URI for undef action with query params in unicode'
+);
+is(
+ Catalyst::uri_for( $context, 'quux', { 'param:1' => "foo" } )->as_string,
+ 'http://127.0.0.1/foo/yada/quux?param%3A1=foo',
+ 'URI for undef action with query params in unicode'
+);
+
+# test with object
+is(
+ Catalyst::uri_for( $context, 'quux', { param1 => $request->base } )->as_string,
+ 'http://127.0.0.1/foo/yada/quux?param1=http%3A%2F%2F127.0.0.1%2Ffoo',
+ 'URI for undef action with query param as object'
+);
+
+$request->base( URI->new('http://localhost:3000/') );
+$request->match( 'orderentry/contract' );
+is(
+ Catalyst::uri_for( $context, '/Orderentry/saveContract' )->as_string,
+ 'http://localhost:3000/Orderentry/saveContract',
+ 'URI for absolute path'
+);
+
+{
+ $request->base( URI->new('http://127.0.0.1/') );
+
+ $context->namespace('');
+
+ is( Catalyst::uri_for( $context, '/bar/baz' )->as_string,
+ 'http://127.0.0.1/bar/baz', 'URI with no base or match' );
+
+ # test "0" as the path
+ is( Catalyst::uri_for( $context, qw/0 foo/ )->as_string,
+ 'http://127.0.0.1/0/foo', '0 as path is ok'
+ );
+
+}
+
+# test with undef -- no warnings should be thrown
+{
+ my $warnings = 0;
+ local $SIG{__WARN__} = sub { $warnings++ };
+
+ Catalyst::uri_for( $context, '/bar/baz', { foo => undef } )->as_string,
+ is( $warnings, 0, "no warnings emitted" );
+}
+
+# Test with parameters '/', 'foo', 'bar' - should not generate a //
+is( Catalyst::uri_for( $context, qw| / foo bar | )->as_string,
+ 'http://127.0.0.1/foo/bar', 'uri is /foo/bar, not //foo/bar'
+);
+
+TODO: {
+ local $TODO = 'RFCs are for people who, erm - fix this test..';
+ # Test rfc3986 reserved characters. These characters should all be escaped
+ # according to the RFC, but it is a very big feature change so I've removed it
+ no warnings; # Yes, everything in qw is sane
+ is(
+ Catalyst::uri_for( $context, qw|! * ' ( ) ; : @ & = $ / ? % # [ ] ,|, )->as_string,
+ 'http://127.0.0.1/%21/%2A/%27/%2B/%29/%3B/%3A/%40/%26/%3D/%24/%2C/%2F/%3F/%25/%23/%5B/%5D',
+ 'rfc 3986 reserved characters'
+ );
+
+ # jshirley bug - why the hell does only one of these get encoded
+ # has been like this forever however.
+ is(
+ Catalyst::uri_for( $context, qw|{1} {2}| )->as_string,
+ 'http://127.0.0.1/{1}/{2}',
+ 'not-escaping unreserved characters'
+ );
+}
+
+# make sure caller's query parameter hash isn't messed up
+{
+ my $query_params_base = {test => "one two",
+ bar => ["foo baz", "bar"]};
+ my $query_params_test = {test => "one two",
+ bar => ["foo baz", "bar"]};
+ Catalyst::uri_for($context, '/bar/baz', $query_params_test);
+ is_deeply($query_params_base, $query_params_test,
+ "uri_for() doesn't mess up query parameter hash in the caller");
+}
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_uri_for_action.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_uri_for_action.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_uri_for_action.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -8,7 +8,7 @@
use Test::More;
-plan tests => 42;
+plan tests => 30;
use_ok('TestApp');
@@ -97,6 +97,10 @@
namespace => 'yada',
} );
+is($context->uri_for($context->controller('Action')),
+ "http://127.0.0.1/foo/yada/action/",
+ "uri_for a controller");
+
is($context->uri_for($path_action),
"http://127.0.0.1/foo/action/relative/relative",
"uri_for correct for path action");
@@ -112,18 +116,10 @@
"http://127.0.0.1/foo/action/regexp/foo/123/bar/baz?q=1",
"uri_for correct for regex with captures, args and query");
-is($context->uri_for($regex_action, 'foo', 123, { q => 1 }),
- "http://127.0.0.1/foo/action/regexp/foo/123?q=1",
- "uri_for correct for regex no captures with args and query");
-
is($context->uri_for($chained_action, [ 1 ], 2, { q => 1 }),
"http://127.0.0.1/foo/chained/foo/1/end/2?q=1",
"uri_for correct for chained with captures, args and query");
-is($context->uri_for($chained_action, 1, 2, { q => 1 }),
- "http://127.0.0.1/foo/chained/foo/1/end/2?q=1",
- "uri_for correct for chained no captures with args and query");
-
#
# More Chained with Context Tests
#
@@ -132,89 +128,47 @@
'http://127.0.0.1/foo/chained/foo2/1/2/end2/3/4?x=5',
'uri_for_action correct for chained with multiple captures and args' );
- is( $context->uri_for_action( '/action/chained/endpoint2', qw(1 2 3 4), { x => 5 } ),
- 'http://127.0.0.1/foo/chained/foo2/1/2/end2/3/4?x=5',
- 'uri_for_action correct for chained without captures with multiple args' );
-
is( $context->uri_for_action( '/action/chained/three_end', [1,2,3], (4,5,6) ),
'http://127.0.0.1/foo/chained/one/1/two/2/3/three/4/5/6',
'uri_for_action correct for chained with multiple capturing actions' );
- is( $context->uri_for_action( '/action/chained/three_end', qw(1 2 3 4 5 6) ),
- 'http://127.0.0.1/foo/chained/one/1/two/2/3/three/4/5/6',
- 'uri_for_action correct for chained no captures multi capturing actions' );
-
- ok( ! defined( $context->uri_for_action( '/action/chained/foo2' ) ),
- 'uri_for_action returns undef for chained action midpoints' );
-
my $action_needs_two = '/action/chained/endpoint2';
-
+
ok( ! defined( $context->uri_for_action($action_needs_two, [1], (2,3)) ),
'uri_for_action returns undef for not enough captures' );
-
- ok( ! defined( $context->uri_for_action($action_needs_two, 1) ),
- 'uri_for_action returns undef for not enough captures/args total' );
-
+
is( $context->uri_for_action($action_needs_two, [1,2], (2,3)),
'http://127.0.0.1/foo/chained/foo2/1/2/end2/2/3',
'uri_for_action returns correct uri for correct captures' );
-
- is( $context->uri_for_action($action_needs_two, qw(1 2 2 3)),
- 'http://127.0.0.1/foo/chained/foo2/1/2/end2/2/3',
- 'uri_for_action returns correct uri for correct captures/args total' );
-
+
ok( ! defined( $context->uri_for_action($action_needs_two, [1,2,3], (2,3)) ),
'uri_for_action returns undef for too many captures' );
-
+
is( $context->uri_for_action($action_needs_two, [1,2], (3)),
'http://127.0.0.1/foo/chained/foo2/1/2/end2/3',
'uri_for_action returns uri with lesser args than specified on action' );
- is( $context->uri_for_action($action_needs_two, qw(1 2 3)),
- 'http://127.0.0.1/foo/chained/foo2/1/2/end2/3',
- 'uri_for_action returns uri with lesser args and no captures' );
-
is( $context->uri_for_action($action_needs_two, [1,2], (3,4,5)),
'http://127.0.0.1/foo/chained/foo2/1/2/end2/3/4/5',
'uri_for_action returns uri with more args than specified on action' );
- is( $context->uri_for_action($action_needs_two, qw(1 2 3 4 5)),
- 'http://127.0.0.1/foo/chained/foo2/1/2/end2/3/4/5',
- 'uri_for_action returns uri with more args and no captures' );
-
is( $context->uri_for_action($action_needs_two, [1,''], (3,4)),
'http://127.0.0.1/foo/chained/foo2/1//end2/3/4',
'uri_for_action returns uri with empty capture on undef capture' );
- is( $context->uri_for_action($action_needs_two, 1, '', 3, 4),
- 'http://127.0.0.1/foo/chained/foo2/1//end2/3/4',
- 'uri_for_action returns uri with no captures and empty arg' );
-
is( $context->uri_for_action($action_needs_two, [1,2], ('',3)),
'http://127.0.0.1/foo/chained/foo2/1/2/end2//3',
'uri_for_action returns uri with empty arg on undef argument' );
- is( $context->uri_for_action($action_needs_two, 1, 2, '', 3),
- 'http://127.0.0.1/foo/chained/foo2/1/2/end2//3',
- 'uri_for_action returns uri no captures with empty arg on undef argument' );
-
is( $context->uri_for_action($action_needs_two, [1,2], (3,'')),
'http://127.0.0.1/foo/chained/foo2/1/2/end2/3/',
'uri_for_action returns uri with empty arg on undef last argument' );
- is( $context->uri_for_action($action_needs_two, 1, 2, 3, ''),
- 'http://127.0.0.1/foo/chained/foo2/1/2/end2/3/',
- 'uri_for_action returns uri no captures empty arg undef last argument' );
-
my $complex_chained = '/action/chained/empty_chain_f';
is( $context->uri_for_action( $complex_chained, [23], (13), {q => 3} ),
'http://127.0.0.1/foo/chained/empty/23/13?q=3',
'uri_for_action returns correct uri for chain with many empty path parts' );
- is( $context->uri_for_action( $complex_chained, 23, 13, {q => 3} ),
- 'http://127.0.0.1/foo/chained/empty/23/13?q=3',
- 'uri_for_action returns correct uri for chain no captures empty path parts' );
-
eval { $context->uri_for_action( '/does/not/exist' ) };
like $@, qr{^Can't find action for path '/does/not/exist'},
'uri_for_action croaks on nonexistent path';
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_uri_with.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_core_uri_with.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_uri_with.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_core_uri_with.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,69 @@
+use strict;
+use warnings;
+
+use Test::More tests => 10;
+use URI;
+
+use_ok('Catalyst::Request');
+
+my $request = Catalyst::Request->new( {
+ uri => URI->new('http://127.0.0.1/foo/bar/baz')
+ } );
+
+is(
+ $request->uri_with({}),
+ 'http://127.0.0.1/foo/bar/baz',
+ 'URI for absolute path'
+);
+
+is(
+ $request->uri_with({ foo => 'bar' }),
+ 'http://127.0.0.1/foo/bar/baz?foo=bar',
+ 'URI adds param'
+);
+
+my $request2 = Catalyst::Request->new( {
+ uri => URI->new('http://127.0.0.1/foo/bar/baz?bar=gorch')
+ } );
+is(
+ $request2->uri_with({}),
+ 'http://127.0.0.1/foo/bar/baz?bar=gorch',
+ 'URI retains param'
+);
+
+is(
+ $request2->uri_with({ me => 'awesome' }),
+ 'http://127.0.0.1/foo/bar/baz?bar=gorch&me=awesome',
+ 'URI retains param and adds new'
+);
+
+is(
+ $request2->uri_with({ bar => undef }),
+ 'http://127.0.0.1/foo/bar/baz',
+ 'URI loses param when explicitly undef'
+);
+
+is(
+ $request2->uri_with({ bar => 'snort' }),
+ 'http://127.0.0.1/foo/bar/baz?bar=snort',
+ 'URI changes param'
+);
+
+is(
+ $request2->uri_with({ bar => [ 'snort', 'ewok' ] }),
+ 'http://127.0.0.1/foo/bar/baz?bar=snort&bar=ewok',
+ 'overwrite mode URI appends arrayref param'
+);
+
+is(
+ $request2->uri_with({ bar => 'snort' }, { mode => 'append' }),
+ 'http://127.0.0.1/foo/bar/baz?bar=gorch&bar=snort',
+ 'append mode URI appends param'
+);
+
+is(
+ $request2->uri_with({ bar => [ 'snort', 'ewok' ] }, { mode => 'append' }),
+ 'http://127.0.0.1/foo/bar/baz?bar=gorch&bar=snort&bar=ewok',
+ 'append mode URI appends arrayref param'
+);
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_dispatcher_requestargs_restore.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_dispatcher_requestargs_restore.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_dispatcher_requestargs_restore.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_dispatcher_requestargs_restore.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,21 @@
+# Insane test case for the behavior needed by Plugin::Auhorization::ACL
+
+# We have to localise $c->request->{arguments} in
+# Catalyst::Dispatcher::_do_forward, rather than using save and restore,
+# as otherwise, the calling $c->detach on an action which says
+# die $Catalyst:DETACH causes the request arguments to not get restored,
+# and therefore sub gorch gets the wrong string $frozjob parameter.
+
+# Please feel free to break this behavior once a sane hook for safely
+# executing another action from the dispatcher (i.e. wrapping actions)
+# is present, so that the Authorization::ACL plugin can be re-written
+# to not be full of such crazy shit.
+
+use strict;
+use warnings;
+use FindBin qw/$Bin/;
+use lib "$Bin/../lib";
+use Catalyst::Test 'ACLTestApp';
+use Test::More tests => 1;
+
+request('http://localhost/gorch/wozzle');
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_load_catalyst_test.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_load_catalyst_test.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_load_catalyst_test.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_load_catalyst_test.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,157 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+use Test::More tests => 61;
+use FindBin qw/$Bin/;
+use lib "$Bin/../lib";
+use Catalyst::Utils;
+use HTTP::Request::Common;
+use Test::Exception;
+
+my $Class = 'Catalyst::Test';
+my $App = 'TestApp';
+my $Pkg = __PACKAGE__;
+my $Url = 'http://localhost/';
+my $Content = "root index";
+
+my %Meth = (
+ $Pkg => [qw|get request ctx_request|], # exported
+ $Class => [qw|local_request remote_request|], # not exported
+);
+
+### make sure we're not trying to connect to a remote host -- these are local tests
+local $ENV{CATALYST_SERVER};
+
+use_ok( $Class );
+
+### check available methods
+{ ### turn of redefine warnings, we'll get new subs exported
+ ### XXX 'no warnings' and 'local $^W' wont work as warnings are turned on in
+ ### test.pm, so trap them for now --kane
+ { local $SIG{__WARN__} = sub {};
+ ok( $Class->import, "Argumentless import for methods only" );
+ }
+
+ while( my($class, $meths) = each %Meth ) {
+ for my $meth ( @$meths ) { SKIP: {
+
+ ### method available?
+ can_ok( $class, $meth );
+
+ ### only for exported methods
+ skip "Error tests only for exported methods", 2 unless $class eq $Pkg;
+
+ ### check error conditions
+ eval { $class->can($meth)->( $Url ) };
+ ok( $@, " $meth without app gives error" );
+ like( $@, qr/$Class/,
+ " Error filled with expected content for '$meth'" );
+ } }
+ }
+}
+
+### simple tests for exported methods
+{ ### turn of redefine warnings, we'll get new subs exported
+ ### XXX 'no warnings' and 'local $^W' wont work as warnings are turned on in
+ ### test.pm, so trap them for now --kane
+ { local $SIG{__WARN__} = sub {};
+ ok( $Class->import( $App ),
+ "Loading $Class for App $App" );
+ }
+
+ ### test exported methods again
+ for my $meth ( @{ $Meth{$Pkg} } ) { SKIP: {
+
+ ### do a call, we should get a result and perhaps a $c if it's 'ctx_request';
+ my ($res, $c) = eval { $Pkg->can($meth)->( $Url ) };
+
+ ok( 1, " Called $Pkg->$meth( $Url )" );
+ ok( !$@, " No critical error $@" );
+ ok( $res, " Result obtained" );
+
+ ### get the content as a string, to make sure we got what we expected
+ my $res_as_string = $meth eq 'get' ? $res : $res->content;
+ is( $res_as_string, $Content,
+ " Content as expected: $res_as_string" );
+
+ ### some tests for 'ctx_request'
+ skip "Context tests skipped for '$meth'", 6 unless $meth eq 'ctx_request';
+
+ ok( $c, " Context object returned" );
+ isa_ok( $c, $App, " Object" );
+ is( $c->request->uri, $Url,
+ " Url recorded in request" );
+ is( $c->response->body, $Content,
+ " Content recorded in response" );
+ ok( $c->stash, " Stash accessible" );
+ ok( $c->action, " Action object accessible" );
+ ok( $res->request, " Response has request object" );
+ lives_and { is( $res->request->uri, $Url) }
+ " Request object has correct url";
+ } }
+}
+
+### perl5.8.8 + cat 5.80's Cat::Test->ctx_request didn't return $c the 2nd
+### time it was invoked. Without tracking the bug down all the way, it was
+### clearly related to the Moose'ification of Cat::Test and a scoping issue
+### with a 'my'd variable. Since the same code works fine in 5.10, a bug in
+### either Moose or perl 5.8 is suspected.
+{ ok( 1, "Testing consistency of ctx_request()" );
+ for( 1..2 ) {
+ my($res, $c) = ctx_request( $Url );
+ ok( $c, " Call $_: Context object returned" );
+ }
+}
+
+# FIXME - These vhosts in tests tests should be somewhere else...
+
+sub customize { Catalyst::Test::_customize_request(@_) }
+
+{
+ my $req = Catalyst::Utils::request('/dummy');
+ customize( $req );
+ is( $req->header('Host'), undef, 'normal request is unmodified' );
+}
+
+{
+ my $req = Catalyst::Utils::request('/dummy');
+ customize( $req, { host => 'customized.com' } );
+ like( $req->header('Host'), qr/customized.com/, 'request is customizable via opts hash' );
+}
+
+{
+ my $req = Catalyst::Utils::request('/dummy');
+ local $Catalyst::Test::default_host = 'localized.com';
+ customize( $req );
+ like( $req->header('Host'), qr/localized.com/, 'request is customizable via package var' );
+}
+
+{
+ my $req = Catalyst::Utils::request('/dummy');
+ local $Catalyst::Test::default_host = 'localized.com';
+ customize( $req, { host => 'customized.com' } );
+ like( $req->header('Host'), qr/customized.com/, 'opts hash takes precedence over package var' );
+}
+
+{
+ my $req = Catalyst::Utils::request('/dummy');
+ local $Catalyst::Test::default_host = 'localized.com';
+ customize( $req, { host => '' } );
+ is( $req->header('Host'), undef, 'default value can be temporarily cleared via opts hash' );
+}
+
+# Back compat test, extra args used to be ignored, now a hashref of options.
+use_ok('Catalyst::Test', 'TestApp', 'foobar');
+
+# Back compat test, ensure that request ignores anything which isn't a hash.
+lives_ok {
+ request(GET('/dummy'), 'foo');
+} 'scalar additional param to request method ignored';
+lives_ok {
+ request(GET('/dummy'), []);
+} 'array additional param to request method ignored';
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_metaclass_compat_extend_non_moose_controller.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_metaclass_compat_extend_non_moose_controller.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_metaclass_compat_extend_non_moose_controller.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_metaclass_compat_extend_non_moose_controller.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,20 @@
+use Catalyst ();
+
+{
+ package TestApp;
+ use base qw/Catalyst/;
+}
+{
+ package TestApp::Controller::Base;
+ use base qw/Catalyst::Controller/;
+}
+{
+ package TestApp::Controller::Other;
+ use Moose;
+ use Test::More tests => 1;
+ use Test::Exception;
+ lives_ok {
+ extends 'TestApp::Controller::Base';
+ };
+}
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_metaclass_compat_non_moose.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_metaclass_compat_non_moose.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_metaclass_compat_non_moose.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_metaclass_compat_non_moose.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,7 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use lib 't/lib';
+use Test::More tests => 1;
+use_ok('TestAppMetaCompat');
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_metaclass_compat_non_moose_controller.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_metaclass_compat_non_moose_controller.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_metaclass_compat_non_moose_controller.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_metaclass_compat_non_moose_controller.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,19 @@
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/../lib";
+
+use Test::More tests => 1;
+use Test::Exception;
+use TestAppNonMooseController;
+
+# Metaclass init order causes fail.
+# There are TODO tests in Moose for this, see
+# f2391d17574eff81d911b97be15ea51080500003
+# after which the evil kludge in core can die in a fire.
+
+lives_ok {
+ TestAppNonMooseController::ControllerBase->get_action_methods
+} 'Base class->get_action_methods ok when sub class initialized first';
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_response.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_response.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_response.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_response.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,18 @@
+use strict;
+use warnings;
+use Test::More tests => 6;
+
+use_ok('Catalyst::Response');
+
+my $res = Catalyst::Response->new;
+
+# test aliasing of res->code for res->status
+$res->code(500);
+is($res->code, 500, 'code sets itself');
+is($res->status, 500, 'code sets status');
+$res->status(501);
+is($res->code, 501, 'status sets code');
+is($res->body, '', "default response body ''");
+$res->body(undef);
+is($res->body, '', "response body '' after assigned undef");
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_utils_env_value.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_utils_env_value.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_utils_env_value.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_utils_env_value.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,44 @@
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+
+use Catalyst::Utils;
+
+##############################################################################
+### No env vars defined
+##############################################################################
+{
+ ok( !Catalyst::Utils::env_value( 'MyApp', 'Key' ),
+ 'No env values defined returns false'
+ );
+}
+
+##############################################################################
+### App env var defined
+##############################################################################
+{
+ $ENV{'MYAPP2_KEY'} = 'Env value 2';
+ is( Catalyst::Utils::env_value( 'MyApp2', 'Key' ),
+ 'Env value 2', 'Got the right value from the application var' );
+}
+
+##############################################################################
+### Catalyst env var defined
+##############################################################################
+{
+ $ENV{'CATALYST_KEY'} = 'Env value 3';
+ is( Catalyst::Utils::env_value( 'MyApp3', 'Key' ),
+ 'Env value 3', 'Got the right value from the catalyst var' );
+}
+
+##############################################################################
+### Catalyst and Application env vars defined
+##############################################################################
+{
+ $ENV{'CATALYST_KEY'} = 'Env value bad';
+ $ENV{'MYAPP4_KEY'} = 'Env value 4';
+ is( Catalyst::Utils::env_value( 'MyApp4', 'Key' ),
+ 'Env value 4', 'Got the right value from the application var' );
+}
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_utils_prefix.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_utils_prefix.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_utils_prefix.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_utils_prefix.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,26 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 8;
+
+use lib "t/lib";
+
+use Catalyst::Utils;
+
+is( Catalyst::Utils::class2prefix('MyApp::V::Foo::Bar'), 'foo/bar', 'class2prefix works with M/V/C' );
+
+is( Catalyst::Utils::class2prefix('MyApp::Controller::Foo::Bar'), 'foo/bar', 'class2prefix works with Model/View/Controller' );
+
+is( Catalyst::Utils::class2prefix('MyApp::Controller::Foo::View::Bar'), 'foo/view/bar', 'class2prefix works with tricky components' );
+
+is( Catalyst::Utils::appprefix('MyApp::Foo'), 'myapp_foo', 'appprefix works' );
+
+is( Catalyst::Utils::class2appclass('MyApp::Foo::Controller::Bar::View::Baz'), 'MyApp::Foo', 'class2appclass works' );
+
+is( Catalyst::Utils::class2classprefix('MyApp::Foo::Controller::Bar::View::Baz'), 'MyApp::Foo::Controller', 'class2classprefix works' );
+
+is( Catalyst::Utils::class2classsuffix('MyApp::Foo::Controller::Bar::View::Baz'), 'Controller::Bar::View::Baz', 'class2classsuffix works' );
+
+is( Catalyst::Utils::class2env('MyApp::Foo'), 'MYAPP_FOO', 'class2env works' );
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_utils_request.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/unit_utils_request.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_utils_request.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/unit_utils_request.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,27 @@
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+
+use Catalyst::Utils;
+
+{
+ my $url = "/dump";
+ ok(
+ my $request = Catalyst::Utils::request($url),
+ "Request: simple get without protocol nor host"
+ );
+ like( $request->uri, qr|^http://localhost/|,
+ " has default protocol and host" );
+}
+
+{
+ my $url = "/dump?url=http://www.somewhere.com/";
+ ok(
+ my $request = Catalyst::Utils::request($url),
+ "Same with param containing a url"
+ );
+ like( $request->uri, qr|^http://localhost/|,
+ " has default protocol and host" );
+}
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/utf8_content_length.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/aggregate/utf8_content_length.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/utf8_content_length.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/aggregate/utf8_content_length.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,30 @@
+use strict;
+use warnings;
+use FindBin qw/$Bin/;
+use lib "$Bin/../lib";
+use File::Spec;
+use Test::More;
+
+use Catalyst::Test qw/TestAppEncoding/;
+
+if ( $ENV{CATALYST_SERVER} ) {
+ plan skip_all => 'This test does not run live';
+ exit 0;
+}
+
+my $fn = "$Bin/../catalyst_130pix.gif";
+ok -r $fn, 'Can read catalyst_130pix.gif';
+my $size = -s $fn;
+{
+ my $r = request('/binary');
+ is $r->code, 200, '/binary OK';
+ is $r->header('Content-Length'), $size, '/binary correct content length';
+}
+{
+ my $r = request('/binary_utf8');
+ is $r->code, 200, '/binary_utf8 OK';
+ is $r->header('Content-Length'), $size, '/binary_utf8 correct content length';
+}
+
+done_testing;
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author (from rev 12002, Catalyst-Runtime/5.80/trunk/t/author)
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/http-server.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/author/http-server.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/http-server.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,96 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More tests => 1;
-
-use File::Path;
-use FindBin;
-use IPC::Open3;
-use IO::Socket;
-
-use Catalyst::Devel 1.0;
-use File::Copy::Recursive;
-
-# Run a single test by providing it as the first arg
-my $single_test = shift;
-
-my $tmpdir = "$FindBin::Bin/../../t/tmp";
-
-# clean up
-rmtree $tmpdir if -d $tmpdir;
-
-# create a TestApp and copy the test libs into it
-mkdir $tmpdir;
-chdir $tmpdir;
-system( $^X, "-I$FindBin::Bin/../../lib", "$FindBin::Bin/../../script/catalyst.pl", 'TestApp' );
-chdir "$FindBin::Bin/..";
-File::Copy::Recursive::dircopy( '../t/lib', '../t/tmp/TestApp/lib' ) or die;
-
-# remove TestApp's tests
-rmtree '../t/tmp/TestApp/t' or die;
-
-# spawn the standalone HTTP server
-my $port = 30000 + int rand(1 + 10000);
-my @cmd = ($^X, "-I$FindBin::Bin/../../lib",
- "$FindBin::Bin/../../t/tmp/TestApp/script/testapp_server.pl", '-port', $port );
-my $pid = open3( undef, my $server, undef, @cmd)
- or die "Unable to spawn standalone HTTP server: $!";
-
-# wait for it to start
-print "Waiting for server to start...\n";
-my $timeout = 30;
-my $count = 0;
-while ( check_port( 'localhost', $port ) != 1 ) {
- sleep 1;
- die("Server did not start within $timeout seconds: " . join(' ', @cmd))
- if $count++ > $timeout;
-}
-
-# run the testsuite against the HTTP server
-$ENV{CATALYST_SERVER} = "http://localhost:$port";
-
-my $return;
-if ( $single_test ) {
- $return = system( "$^X -I../lib/ $single_test" );
-}
-else {
- $return = prove( '-r', '-I../lib/', glob('../t/aggregate/live_*.t') );
-}
-
-# shut it down
-kill 'INT', $pid;
-close $server;
-
-# clean up
-rmtree "$FindBin::Bin/../../t/tmp" if -d "$FindBin::Bin/../../t/tmp";
-
-is( $return, 0, 'live tests' );
-
-sub check_port {
- my ( $host, $port ) = @_;
-
- my $remote = IO::Socket::INET->new(
- Proto => "tcp",
- PeerAddr => $host,
- PeerPort => $port
- );
- if ($remote) {
- close $remote;
- return 1;
- }
- else {
- return 0;
- }
-}
-
-sub prove {
- if (!(my $pid = fork)) {
- require App::Prove;
- my $prove = App::Prove->new;
- $prove->process_args(@_);
- exit( $prove->run ? 0 : 1 );
- } else {
- waitpid $pid, 0;
- return $?;
- }
-}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/http-server.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/author/http-server.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/http-server.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/http-server.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,96 @@
+use strict;
+use warnings;
+
+use Test::More tests => 1;
+
+use File::Path;
+use FindBin;
+use IPC::Open3;
+use IO::Socket;
+
+use Catalyst::Devel 1.0;
+use File::Copy::Recursive;
+
+# Run a single test by providing it as the first arg
+my $single_test = shift;
+
+my $tmpdir = "$FindBin::Bin/../../t/tmp";
+
+# clean up
+rmtree $tmpdir if -d $tmpdir;
+
+# create a TestApp and copy the test libs into it
+mkdir $tmpdir;
+chdir $tmpdir;
+system( $^X, "-I$FindBin::Bin/../../lib", "$FindBin::Bin/../../script/catalyst.pl", 'TestApp' );
+chdir "$FindBin::Bin/..";
+File::Copy::Recursive::dircopy( '../t/lib', '../t/tmp/TestApp/lib' ) or die;
+
+# remove TestApp's tests
+rmtree '../t/tmp/TestApp/t' or die;
+
+# spawn the standalone HTTP server
+my $port = 30000 + int rand(1 + 10000);
+my @cmd = ($^X, "-I$FindBin::Bin/../../lib",
+ "$FindBin::Bin/../../t/tmp/TestApp/script/testapp_server.pl", '-port', $port );
+my $pid = open3( undef, my $server, undef, @cmd)
+ or die "Unable to spawn standalone HTTP server: $!";
+
+# wait for it to start
+print "Waiting for server to start...\n";
+my $timeout = 30;
+my $count = 0;
+while ( check_port( 'localhost', $port ) != 1 ) {
+ sleep 1;
+ die("Server did not start within $timeout seconds: " . join(' ', @cmd))
+ if $count++ > $timeout;
+}
+
+# run the testsuite against the HTTP server
+$ENV{CATALYST_SERVER} = "http://localhost:$port";
+
+my $return;
+if ( $single_test ) {
+ $return = system( "$^X -I../lib/ $single_test" );
+}
+else {
+ $return = prove( '-r', '-I../lib/', glob('../t/aggregate/live_*.t') );
+}
+
+# shut it down
+kill 'INT', $pid;
+close $server;
+
+# clean up
+rmtree "$FindBin::Bin/../../t/tmp" if -d "$FindBin::Bin/../../t/tmp";
+
+is( $return, 0, 'live tests' );
+
+sub check_port {
+ my ( $host, $port ) = @_;
+
+ my $remote = IO::Socket::INET->new(
+ Proto => "tcp",
+ PeerAddr => $host,
+ PeerPort => $port
+ );
+ if ($remote) {
+ close $remote;
+ return 1;
+ }
+ else {
+ return 0;
+ }
+}
+
+sub prove {
+ if (!(my $pid = fork)) {
+ require App::Prove;
+ my $prove = App::Prove->new;
+ $prove->process_args(@_);
+ exit( $prove->run ? 0 : 1 );
+ } else {
+ waitpid $pid, 0;
+ return $?;
+ }
+}
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/notabs.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/author/notabs.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/notabs.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,10 +0,0 @@
-use strict;
-use warnings;
-
-use File::Spec;
-use FindBin ();
-use Test::More;
-use Test::NoTabs;
-
-all_perl_files_ok(qw/lib/);
-
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/notabs.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/author/notabs.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/notabs.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/notabs.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,10 @@
+use strict;
+use warnings;
+
+use File::Spec;
+use FindBin ();
+use Test::More;
+use Test::NoTabs;
+
+all_perl_files_ok(qw/lib/);
+
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/pod.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/author/pod.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/pod.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,8 +0,0 @@
-use strict;
-use warnings;
-use Test::More;
-
-use Test::Pod 1.14;
-
-all_pod_files_ok();
-
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/pod.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/author/pod.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/pod.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/pod.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,8 @@
+use strict;
+use warnings;
+use Test::More;
+
+use Test::Pod 1.14;
+
+all_pod_files_ok();
+
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/podcoverage.t
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/author/podcoverage.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/podcoverage.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,13 +0,0 @@
-use strict;
-use warnings;
-use Test::More;
-
-use Pod::Coverage 0.19;
-use Test::Pod::Coverage 1.04;
-
-all_pod_coverage_ok(
- {
- also_private => ['BUILD']
- }
-);
-
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/podcoverage.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/author/podcoverage.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/podcoverage.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/author/podcoverage.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,13 @@
+use strict;
+use warnings;
+use Test::More;
+
+use Pod::Coverage 0.19;
+use Test::Pod::Coverage 1.04;
+
+all_pod_coverage_ok(
+ {
+ also_private => ['BUILD']
+ }
+);
+
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/c3_mro.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/c3_mro.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/c3_mro.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -4,15 +4,13 @@
use Test::More;
require Catalyst;
require Module::Pluggable::Object;
-use MRO::Compat;
+eval "require Class::C3";
+plan skip_all => "This test requires Class::C3" if $@;
+
# Get a list of all Catalyst:: packages in blib via M::P::O
my @cat_mods;
{
- # problem with @INC on win32, see:
- # http://rt.cpan.org/Ticket/Display.html?id=26452
- if ($^O eq 'MSWin32') { require Win32; Win32::GetCwd(); }
-
local @INC = grep {/blib/} @INC;
@cat_mods = (
'Catalyst',
@@ -32,7 +30,7 @@
#
foreach my $cat_mod (@cat_mods) {
eval " require $cat_mod ";
- eval { mro::get_linear_isa($cat_mod, 'c3') };
- ok(!$@, "calculateMRO for $cat_mod: $@");
+ eval { Class::C3::calculateMRO($cat_mod) };
+ ok(!$@, "calculateMRO for $cat_mod");
}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/custom_exception_class_simple.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/custom_exception_class_simple.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/custom_exception_class_simple.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/custom_exception_class_simple.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,12 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use FindBin qw/$Bin/;
+use lib "$Bin/lib";
+use Test::More tests => 1;
+use Test::Exception;
+
+lives_ok {
+ require TestAppClassExceptionSimpleTest;
+} 'Can load application';
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/custom_live_component_controller_action_auto_doublebug.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/custom_live_component_controller_action_auto_doublebug.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/custom_live_component_controller_action_auto_doublebug.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,48 +0,0 @@
-#!perl
-
-use strict;
-use warnings;
-
-use FindBin;
-use lib "$FindBin::Bin/lib";
-
-our $iters;
-
-BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-
-use Test::More tests => 3*$iters;
-use Catalyst::Test 'TestAppDoubleAutoBug';
-
-if ( $ENV{CAT_BENCHMARK} ) {
- require Benchmark;
- Benchmark::timethis( $iters, \&run_tests );
-}
-else {
- for ( 1 .. $iters ) {
- run_tests();
- }
-}
-
-sub run_tests {
- SKIP:
- {
- if ( $ENV{CATALYST_SERVER} ) {
- skip 'Using remote server', 3;
- }
-
- {
- my @expected = qw[
- TestAppDoubleAutoBug->auto
- TestAppDoubleAutoBug->default
- TestAppDoubleAutoBug->end
- ];
-
- my $expected = join( ", ", @expected );
-
- ok( my $response = request('http://localhost/action/auto/one'), 'auto + local' );
- is( $response->header('X-Catalyst-Executed'),
- $expected, 'Executed actions' );
- is( $response->content, 'default, auto=1', 'Content OK' );
- }
- }
-}
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/deprecated.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/deprecated.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/deprecated.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -9,13 +9,18 @@
my $warnings;
BEGIN { # Do this at compile time in case we generate a warning when use
# DeprecatedTestApp
- $SIG{__WARN__} = sub { $warnings++ if $_[0] =~ /trying to use NEXT/ };
+ $SIG{__WARN__} = sub {
+ $warnings++ if $_[0] =~ /uses NEXT, which is deprecated/;
+ $warnings++ if $_[0] =~ /trying to use NEXT, which is deprecated/;
+ };
}
use Catalyst; # Cause catalyst to be used so I can fiddle with the logging.
my $mvc_warnings;
BEGIN {
my $logger = Class::MOP::Class->create_anon_class(
methods => {
+ debug => sub {0},
+ info => sub {0},
warn => sub {
if ($_[1] =~ /switch your class names/) {
$mvc_warnings++;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/deprecated_appclass_action_warnings.t (from rev 12002, Catalyst-Runtime/5.80/trunk/t/deprecated_appclass_action_warnings.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/deprecated_appclass_action_warnings.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/deprecated_appclass_action_warnings.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,18 @@
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More;
+use Catalyst::Test 'DeprecatedActionsInAppClassTestApp';
+
+plan tests => 3;
+
+my $warnings;
+my $logger = DeprecatedActionsInAppClassTestApp::Log->new;
+Catalyst->log($logger);
+
+ok( my $response = request('http://localhost/foo'), 'Request' );
+ok( $response->is_success, 'Response Successful 2xx' );
+is( $DeprecatedActionsInAppClassTestApp::Log::warnings, 1, 'Get the appclass action warning' );
\ No newline at end of file
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/ACLTestApp (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/ACLTestApp)
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/ACLTestApp/Controller (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/ACLTestApp/Controller)
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/ACLTestApp/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/ACLTestApp/Controller/Root.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/ACLTestApp/Controller/Root.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,18 +0,0 @@
-package ACLTestApp::Controller::Root;
-use Test::More;
-
-use base 'Catalyst::Controller';
-
-__PACKAGE__->config->{namespace} = '';
-
-sub foobar : Private {
- die $Catalyst::DETACH;
-}
-
-sub gorch : Local {
- my ( $self, $c, $frozjob ) = @_;
- is $frozjob, 'wozzle';
- $c->res->body("gorch");
-}
-
-1;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/ACLTestApp/Controller/Root.pm (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/ACLTestApp/Controller/Root.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/ACLTestApp/Controller/Root.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/ACLTestApp/Controller/Root.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,18 @@
+package ACLTestApp::Controller::Root;
+use Test::More;
+
+use base 'Catalyst::Controller';
+
+__PACKAGE__->config->{namespace} = '';
+
+sub foobar : Private {
+ die $Catalyst::DETACH;
+}
+
+sub gorch : Local {
+ my ( $self, $c, $frozjob ) = @_;
+ is $frozjob, 'wozzle';
+ $c->res->body("gorch");
+}
+
+1;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/ACLTestApp.pm (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/ACLTestApp.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/ACLTestApp.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/ACLTestApp.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,26 @@
+package ACLTestApp;
+use Test::More;
+
+use strict;
+use warnings;
+use MRO::Compat;
+use Scalar::Util ();
+
+use base qw/Catalyst Catalyst::Controller/;
+use Catalyst qw//;
+
+sub execute {
+ my $c = shift;
+ my ( $class, $action ) = @_;
+
+ if ( Scalar::Util::blessed($action)
+ and $action->name ne "foobar" ) {
+ eval { $c->detach( 'foobar', [$action, 'foo'] ) };
+ }
+
+ $c->next::method( @_ );
+}
+
+__PACKAGE__->setup;
+
+1;
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/Catalyst/Plugin/Test/Deprecated.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/Catalyst/Plugin/Test/Deprecated.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/Catalyst/Plugin/Test/Deprecated.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -2,7 +2,6 @@
use strict;
use warnings;
-use NEXT;
sub prepare {
my $class = shift;
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/Catalyst/Plugin/Test/Plugin.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/Catalyst/Plugin/Test/Plugin.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/Catalyst/Plugin/Test/Plugin.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -4,7 +4,7 @@
use warnings;
use MRO::Compat;
-use base qw/Catalyst::Controller Class::Data::Inheritable/;
+use base qw/Class::Data::Inheritable/;
__PACKAGE__->mk_classdata('ran_setup');
@@ -22,26 +22,14 @@
return $c;
}
-# Note: This is horrible, but Catalyst::Plugin::Server forces the body to
+# Note: Catalyst::Plugin::Server forces the body to
# be parsed, by calling the $c->req->body method in prepare_action.
# We need to test this, as this was broken by 5.80. See also
-# t/aggregate/live_engine_request_body.t. Better ways to test this
-# appreciated if you have suggestions :)
-{
- my $have_req_body = 0;
- sub prepare_action {
- my $c = shift;
- $have_req_body++ if $c->req->body;
- $c->next::method(@_);
- }
- sub have_req_body_in_prepare_action : Local {
- my ($self, $c) = @_;
- $c->res->body($have_req_body);
- }
+# t/aggregate/live_engine_request_body.t.
+sub prepare_action {
+ my $c = shift;
+ $c->res->header('X-Have-Request-Body', 1) if $c->req->body;
+ $c->next::method(@_);
}
-sub end : Private {
- my ($self,$c) = @_;
-}
-
1;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/DeprecatedActionsInAppClassTestApp.pm (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/DeprecatedActionsInAppClassTestApp.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/DeprecatedActionsInAppClassTestApp.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/DeprecatedActionsInAppClassTestApp.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,30 @@
+package DeprecatedActionsInAppClassTestApp;
+
+use strict;
+use warnings;
+use Catalyst;
+
+our $VERSION = '0.01';
+
+__PACKAGE__->config( name => 'DeprecatedActionsInAppClassTestApp', root => '/some/dir' );
+__PACKAGE__->log(DeprecatedActionsInAppClassTestApp::Log->new);
+__PACKAGE__->setup;
+
+sub foo : Local {
+ my ($self, $c) = @_;
+ $c->res->body('OK');
+}
+
+package DeprecatedActionsInAppClassTestApp::Log;
+use strict;
+use warnings;
+use base qw/Catalyst::Log/;
+
+our $warnings;
+
+sub warn {
+ my ($self, $warning) = @_;
+ $warnings++ if $warning =~ /action methods .+ found defined/i;
+}
+
+1;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/PluginTestApp (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/PluginTestApp)
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/PluginTestApp/Controller (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/PluginTestApp/Controller)
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/PluginTestApp/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/PluginTestApp/Controller/Root.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/PluginTestApp/Controller/Root.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,55 +0,0 @@
-package PluginTestApp::Controller::Root;
-use Test::More;
-
-use base 'Catalyst::Controller';
-
-#use Catalyst qw(
-# Test::Plugin
-# +TestApp::Plugin::FullyQualified
-# );
-
-__PACKAGE__->config->{namespace} = '';
-
-sub compile_time_plugins : Local {
- my ( $self, $c ) = @_;
-
- isa_ok $c, 'Catalyst::Plugin::Test::Plugin';
- isa_ok $c, 'TestApp::Plugin::FullyQualified';
-
- can_ok $c, 'registered_plugins';
- $c->_test_plugins;
-
- $c->res->body("ok");
-}
-
-sub run_time_plugins : Local {
- my ( $self, $c ) = @_;
-
- $c->_test_plugins;
- my $faux_plugin = 'Faux::Plugin';
-
-# Trick perl into thinking the plugin is already loaded
- $INC{'Faux/Plugin.pm'} = 1;
-
- ref($c)->plugin( faux => $faux_plugin );
-
- isa_ok $c, 'Catalyst::Plugin::Test::Plugin';
- isa_ok $c, 'TestApp::Plugin::FullyQualified';
- ok !$c->isa($faux_plugin),
- '... and it should not inherit from the instant plugin';
- can_ok $c, 'faux';
- is $c->faux->count, 1, '... and it should behave correctly';
- is_deeply [ $c->registered_plugins ],
- [
- qw/Catalyst::Plugin::Test::Plugin
- Faux::Plugin
- TestApp::Plugin::FullyQualified/
- ],
- 'registered_plugins() should report all plugins';
- ok $c->registered_plugins('Faux::Plugin'),
- '... and even the specific instant plugin';
-
- $c->res->body("ok");
-}
-
-1;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/PluginTestApp/Controller/Root.pm (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/PluginTestApp/Controller/Root.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/PluginTestApp/Controller/Root.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/PluginTestApp/Controller/Root.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,55 @@
+package PluginTestApp::Controller::Root;
+use Test::More;
+
+use base 'Catalyst::Controller';
+
+#use Catalyst qw(
+# Test::Plugin
+# +TestApp::Plugin::FullyQualified
+# );
+
+__PACKAGE__->config->{namespace} = '';
+
+sub compile_time_plugins : Local {
+ my ( $self, $c ) = @_;
+
+ isa_ok $c, 'Catalyst::Plugin::Test::Plugin';
+ isa_ok $c, 'TestApp::Plugin::FullyQualified';
+
+ can_ok $c, 'registered_plugins';
+ $c->_test_plugins;
+
+ $c->res->body("ok");
+}
+
+sub run_time_plugins : Local {
+ my ( $self, $c ) = @_;
+
+ $c->_test_plugins;
+ my $faux_plugin = 'Faux::Plugin';
+
+# Trick perl into thinking the plugin is already loaded
+ $INC{'Faux/Plugin.pm'} = 1;
+
+ ref($c)->plugin( faux => $faux_plugin );
+
+ isa_ok $c, 'Catalyst::Plugin::Test::Plugin';
+ isa_ok $c, 'TestApp::Plugin::FullyQualified';
+ ok !$c->isa($faux_plugin),
+ '... and it should not inherit from the instant plugin';
+ can_ok $c, 'faux';
+ is $c->faux->count, 1, '... and it should behave correctly';
+ is_deeply [ $c->registered_plugins ],
+ [
+ qw/Catalyst::Plugin::Test::Plugin
+ Faux::Plugin
+ TestApp::Plugin::FullyQualified/
+ ],
+ 'registered_plugins() should report all plugins';
+ ok $c->registered_plugins('Faux::Plugin'),
+ '... and even the specific instant plugin';
+
+ $c->res->body("ok");
+}
+
+1;
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/PluginTestApp.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/PluginTestApp.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/PluginTestApp.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -6,48 +6,6 @@
+TestApp::Plugin::FullyQualified
);
-sub compile_time_plugins : Local {
- my ( $self, $c ) = @_;
-
- isa_ok $c, 'Catalyst::Plugin::Test::Plugin';
- isa_ok $c, 'TestApp::Plugin::FullyQualified';
-
- can_ok $c, 'registered_plugins';
- $c->_test_plugins;
-
- $c->res->body("ok");
-}
-
-sub run_time_plugins : Local {
- my ( $self, $c ) = @_;
-
- $c->_test_plugins;
- my $faux_plugin = 'Faux::Plugin';
-
-# Trick perl into thinking the plugin is already loaded
- $INC{'Faux/Plugin.pm'} = 1;
-
- __PACKAGE__->plugin( faux => $faux_plugin );
-
- isa_ok $c, 'Catalyst::Plugin::Test::Plugin';
- isa_ok $c, 'TestApp::Plugin::FullyQualified';
- ok !$c->isa($faux_plugin),
- '... and it should not inherit from the instant plugin';
- can_ok $c, 'faux';
- is $c->faux->count, 1, '... and it should behave correctly';
- is_deeply [ $c->registered_plugins ],
- [
- qw/Catalyst::Plugin::Test::Plugin
- Faux::Plugin
- TestApp::Plugin::FullyQualified/
- ],
- 'registered_plugins() should report all plugins';
- ok $c->registered_plugins('Faux::Plugin'),
- '... and even the specific instant plugin';
-
- $c->res->body("ok");
-}
-
sub _test_plugins {
my $c = shift;
is_deeply [ $c->registered_plugins ],
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Action/TestMyAction.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Action/TestMyAction.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Action/TestMyAction.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -9,6 +9,9 @@
my $self = shift;
my ( $controller, $c, $test ) = @_;
$c->res->header( 'X-TestAppActionTestMyAction', 'MyAction works' );
+ $c->res->header( 'X-Component-Name-Action', $controller->catalyst_component_name);
+ $c->res->header( 'X-Component-Instance-Name-Action', ref($controller));
+ $c->res->header( 'X-Class-In-Action', $self->class);
$self->next::method(@_);
}
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Action/Chained.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Action/Chained.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Action/Chained.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -204,6 +204,13 @@
$c->req->args([ map { decode_entities($_) } @{ $c->req->args }]);
}
+sub roundtrip_urifor : Chained('/') PathPart('chained/roundtrip_urifor') CaptureArgs(1) {}
+sub roundtrip_urifor_end : Chained('roundtrip_urifor') PathPart('') Args(1) {
+ my ($self, $c) = @_;
+ # This should round-trip, always - i.e. the uri you put in should come back out.
+ $c->res->body($c->uri_for($c->action, $c->req->captures, @{$c->req->args}, $c->req->parameters));
+ $c->stash->{no_end} = 1;
+}
sub end :Private {
my ($self, $c) = @_;
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Action/Private.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Action/Private.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Action/Private.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -8,27 +8,27 @@
$c->res->output('access denied');
}
-sub one : Private {
+sub one : Private {
my ( $self, $c ) = @_;
$c->res->output('access allowed');
}
-sub two : Private Relative {
+sub two : Private {
my ( $self, $c ) = @_;
$c->res->output('access allowed');
}
-sub three : Private Absolute {
+sub three : Private {
my ( $self, $c ) = @_;
$c->res->output('access allowed');
}
-sub four : Private Path('/action/private/four') {
+sub four : Private {
my ( $self, $c ) = @_;
$c->res->output('access allowed');
}
-sub five : Private Path('five') {
+sub five : Private {
my ( $self, $c ) = @_;
$c->res->output('access allowed');
}
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Action/Streaming.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Action/Streaming.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Action/Streaming.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -16,7 +16,7 @@
sub body : Local {
my ( $self, $c ) = @_;
-
+
my $file = "$FindBin::Bin/../lib/TestApp/Controller/Action/Streaming.pm";
my $fh = IO::File->new( $file, 'r' );
if ( defined $fh ) {
@@ -27,4 +27,16 @@
}
}
+sub body_large : Local {
+ my ($self, $c) = @_;
+
+ # more than one write with the default chunksize
+ my $size = 128 * 1024;
+
+ my $data = "\0" x $size;
+ open my $fh, '<', \$data;
+ $c->res->content_length($size);
+ $c->res->body($fh);
+}
+
1;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Anon.pm (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestApp/Controller/Anon.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Anon.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Anon.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,40 @@
+package Anon::Trait;
+use Moose::Role -traits => 'MethodAttributes'; # Needed for role composition to work correctly with anon classes.
+
+after test => sub {
+ my ($self, $c) = @_;
+ $c->res->header('X-Anon-Trait-Applied', 1);
+};
+
+no Moose::Role;
+
+package TestApp::Controller::Anon;
+use Moose;
+use Moose::Util qw/find_meta/;
+use namespace::clean -except => 'meta';
+BEGIN { extends 'Catalyst::Controller' };
+
+sub COMPONENT { # Don't do this yourself, use CatalystX::Component::Traits!
+ my ($class, $app, $args) = @_;
+
+ my $meta = $class->meta->create_anon_class(
+ superclasses => [ $class->meta->name ],
+ roles => ['Anon::Trait'],
+ cache => 1,
+ );
+ # Special move as the methodattributes trait has changed our metaclass..
+ $meta = find_meta($meta->name);
+
+ $meta->add_method('meta' => sub { $meta });
+ $class = $meta->name;
+ $class->new($app, $args);
+}
+
+sub test : Local ActionClass('+TestApp::Action::TestMyAction') {
+ my ($self, $c) = @_;
+ $c->res->header('X-Component-Name-Controller', $self->catalyst_component_name);
+ $c->res->body('It works');
+}
+
+__PACKAGE__->meta->make_immutable;
+
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Dump.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Dump.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Dump.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -3,7 +3,7 @@
use strict;
use base 'Catalyst::Controller';
-sub default : Action Private {
+sub default : Action {
my ( $self, $c ) = @_;
$c->forward('TestApp::View::Dump');
}
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Root.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/Controller/Root.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,5 +1,6 @@
package TestApp::Controller::Root;
-
+use strict;
+use warnings;
use base 'Catalyst::Controller';
__PACKAGE__->config->{namespace} = '';
@@ -20,4 +21,36 @@
$c->forward('TestApp::View::Dump::Request');
}
+sub index : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body('root index');
+}
+
+sub global_action : Private {
+ my ( $self, $c ) = @_;
+ $c->forward('TestApp::View::Dump::Request');
+}
+
+sub class_forward_test_method :Private {
+ my ( $self, $c ) = @_;
+ $c->response->headers->header( 'X-Class-Forward-Test-Method' => 1 );
+}
+
+sub loop_test : Local {
+ my ( $self, $c ) = @_;
+
+ for( 1..1001 ) {
+ $c->forward( 'class_forward_test_method' );
+ }
+}
+
+sub recursion_test : Local {
+ my ( $self, $c ) = @_;
+ $c->forward( 'recursion_test' );
+}
+
+sub end : Private {
+ my ($self,$c) = @_;
+}
+
1;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/View/Dump/Parameters.pm (from rev 4483, trunk/Catalyst/t/lib/TestApp/View/Dump/Parameters.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/View/Dump/Parameters.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp/View/Dump/Parameters.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,11 @@
+package TestApp::View::Dump::Parameters;
+
+use strict;
+use base 'TestApp::View::Dump';
+
+sub process {
+ my ( $self, $c ) = @_;
+ return $self->SUPER::process( $c, $c->req->parameters );
+}
+
+1;
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestApp.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -41,16 +41,6 @@
TestApp->setup;
-sub index : Private {
- my ( $self, $c ) = @_;
- $c->res->body('root index');
-}
-
-sub global_action : Private {
- my ( $self, $c ) = @_;
- $c->forward('TestApp::View::Dump::Request');
-}
-
sub execute {
my $c = shift;
my $class = ref( $c->component( $_[0] ) ) || $_[0];
@@ -77,7 +67,7 @@
@executed
);
}
-
+ no warnings 'recursion';
return $c->SUPER::execute(@_);
}
@@ -92,24 +82,6 @@
$c->res->body( 'FATAL ERROR: ' . join( ', ', @{ $c->error } ) );
}
-sub class_forward_test_method :Private {
- my ( $self, $c ) = @_;
- $c->response->headers->header( 'X-Class-Forward-Test-Method' => 1 );
-}
-
-sub loop_test : Local {
- my ( $self, $c ) = @_;
-
- for( 1..1001 ) {
- $c->forward( 'class_forward_test_method' );
- }
-}
-
-sub recursion_test : Local {
- my ( $self, $c ) = @_;
- $c->forward( 'recursion_test' );
-}
-
{
no warnings 'redefine';
sub Catalyst::Log::error { }
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppClassExceptionSimpleTest.pm (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppClassExceptionSimpleTest.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppClassExceptionSimpleTest.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppClassExceptionSimpleTest.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,19 @@
+package TestAppClassExceptionSimpleTest::Exception;
+use strict;
+use warnings;
+
+sub throw {}
+
+#########
+
+package TestAppClassExceptionSimpleTest;
+use strict;
+use warnings;
+
+BEGIN { $Catalyst::Exception::CATALYST_EXCEPTION_CLASS = 'TestAppClassExceptionSimpleTest::Exception'; }
+
+use Catalyst;
+
+__PACKAGE__->setup;
+
+1;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppDoubleAutoBug (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppDoubleAutoBug)
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppDoubleAutoBug/Controller (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppDoubleAutoBug/Controller)
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppDoubleAutoBug/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestAppDoubleAutoBug/Controller/Root.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppDoubleAutoBug/Controller/Root.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,22 +0,0 @@
-package TestAppDoubleAutoBug::Controller::Root;
-
-use base 'Catalyst::Controller';
-
-__PACKAGE__->config->{namespace} = '';
-
-sub auto : Private {
- my ( $self, $c ) = @_;
- ++$c->stash->{auto_count};
- return 1;
-}
-
-sub default : Private {
- my ( $self, $c ) = @_;
- $c->res->body( sprintf 'default, auto=%d', $c->stash->{auto_count} );
-}
-
-sub end : Private {
- my ($self,$c) = @_;
-}
-
-1;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppDoubleAutoBug/Controller/Root.pm (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppDoubleAutoBug/Controller/Root.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppDoubleAutoBug/Controller/Root.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppDoubleAutoBug/Controller/Root.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,22 @@
+package TestAppDoubleAutoBug::Controller::Root;
+
+use base 'Catalyst::Controller';
+
+__PACKAGE__->config->{namespace} = '';
+
+sub auto : Private {
+ my ( $self, $c ) = @_;
+ ++$c->stash->{auto_count};
+ return 1;
+}
+
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->res->body( sprintf 'default, auto=%d', $c->stash->{auto_count} );
+}
+
+sub end : Private {
+ my ($self,$c) = @_;
+}
+
+1;
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppDoubleAutoBug.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppDoubleAutoBug.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppDoubleAutoBug.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -45,15 +45,5 @@
return $c->SUPER::execute(@_);
}
+1;
-
-sub auto : Private {
- my ( $self, $c ) = @_;
- ++$c->stash->{auto_count};
- return 1;
-}
-
-sub default : Private {
- my ( $self, $c ) = @_;
- $c->res->body( sprintf 'default, auto=%d', $c->stash->{auto_count} );
-}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppEncoding (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppEncoding)
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppEncoding/Controller (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppEncoding/Controller)
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppEncoding/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestAppEncoding/Controller/Root.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppEncoding/Controller/Root.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,27 +0,0 @@
-package TestAppEncoding::Controller::Root;
-use strict;
-use warnings;
-use base 'Catalyst::Controller';
-use Test::More;
-
-__PACKAGE__->config->{namespace} = '';
-
-sub binary : Local {
- my ($self, $c) = @_;
- $c->res->body(do { open(my $fh, '<', $c->path_to('..', '..', 'catalyst_130pix.gif')) or die $!; local $/ = undef; <$fh>; });
-}
-
-sub binary_utf8 : Local {
- my ($self, $c) = @_;
- $c->forward('binary');
- my $str = $c->res->body;
- utf8::upgrade($str);
- ok utf8::is_utf8($str), 'Body is variable width encoded string';
- $c->res->body($str);
-}
-
-sub end : Private {
- my ($self,$c) = @_;
-}
-
-1;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppEncoding/Controller/Root.pm (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppEncoding/Controller/Root.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppEncoding/Controller/Root.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppEncoding/Controller/Root.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,27 @@
+package TestAppEncoding::Controller::Root;
+use strict;
+use warnings;
+use base 'Catalyst::Controller';
+use Test::More;
+
+__PACKAGE__->config->{namespace} = '';
+
+sub binary : Local {
+ my ($self, $c) = @_;
+ $c->res->body(do { open(my $fh, '<', $c->path_to('..', '..', 'catalyst_130pix.gif')) or die $!; local $/ = undef; <$fh>; });
+}
+
+sub binary_utf8 : Local {
+ my ($self, $c) = @_;
+ $c->forward('binary');
+ my $str = $c->res->body;
+ utf8::upgrade($str);
+ ok utf8::is_utf8($str), 'Body is variable width encoded string';
+ $c->res->body($str);
+}
+
+sub end : Private {
+ my ($self,$c) = @_;
+}
+
+1;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppEncoding.pm (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppEncoding.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppEncoding.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppEncoding.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,11 @@
+package TestAppEncoding;
+use strict;
+use warnings;
+use base qw/Catalyst/;
+use Catalyst;
+
+__PACKAGE__->config(name => __PACKAGE__);
+__PACKAGE__->setup;
+
+1;
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppNonMooseController)
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/Controller (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppNonMooseController/Controller)
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/Controller/Foo.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestAppNonMooseController/Controller/Foo.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/Controller/Foo.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,5 +0,0 @@
-package TestAppNonMooseController::Controller::Foo;
-use base qw/TestAppNonMooseController::ControllerBase/;
-
-1;
-
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/Controller/Foo.pm (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppNonMooseController/Controller/Foo.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/Controller/Foo.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/Controller/Foo.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,5 @@
+package TestAppNonMooseController::Controller::Foo;
+use base qw/TestAppNonMooseController::ControllerBase/;
+
+1;
+
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/ControllerBase.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestAppNonMooseController/ControllerBase.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/ControllerBase.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,5 +0,0 @@
-package TestAppNonMooseController::ControllerBase;
-use base qw/Catalyst::Controller/;
-
-1;
-
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/ControllerBase.pm (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppNonMooseController/ControllerBase.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/ControllerBase.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController/ControllerBase.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,5 @@
+package TestAppNonMooseController::ControllerBase;
+use base qw/Catalyst::Controller/;
+
+1;
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController.pm (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppNonMooseController.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppNonMooseController.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,8 @@
+package TestAppNonMooseController;
+use base qw/Catalyst/;
+use Catalyst;
+
+__PACKAGE__->setup;
+
+1;
+
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPathBug.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPathBug.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPathBug.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -2,13 +2,15 @@
use warnings;
package TestAppPathBug;
-
+use strict;
+use warnings;
use Catalyst;
our $VERSION = '0.01';
__PACKAGE__->config( name => 'TestAppPathBug', root => '/some/dir' );
+__PACKAGE__->log(TestAppPathBug::Log->new);
__PACKAGE__->setup;
sub foo : Path {
@@ -16,4 +18,11 @@
$c->res->body( 'This is the foo method.' );
}
+package TestAppPathBug::Log;
+use strict;
+use warnings;
+use base qw/Catalyst::Log/;
+
+sub warn {}
+
1;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPluginWithConstructor (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppPluginWithConstructor)
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPluginWithConstructor/Controller (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppPluginWithConstructor/Controller)
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPluginWithConstructor/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestAppPluginWithConstructor/Controller/Root.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPluginWithConstructor/Controller/Root.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,12 +0,0 @@
-package TestAppPluginWithConstructor::Controller::Root;
-
-use base 'Catalyst::Controller';
-
-__PACKAGE__->config->{namespace} = '';
-
-sub foo : Local {
- my ($self, $c) = @_;
- $c->res->body('foo');
-}
-
-1;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPluginWithConstructor/Controller/Root.pm (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppPluginWithConstructor/Controller/Root.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPluginWithConstructor/Controller/Root.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPluginWithConstructor/Controller/Root.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,12 @@
+package TestAppPluginWithConstructor::Controller::Root;
+
+use base 'Catalyst::Controller';
+
+__PACKAGE__->config->{namespace} = '';
+
+sub foo : Local {
+ my ($self, $c) = @_;
+ $c->res->body('foo');
+}
+
+1;
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPluginWithConstructor.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPluginWithConstructor.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppPluginWithConstructor.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -4,13 +4,8 @@
use Test::Exception;
use Catalyst qw/+TestPluginWithConstructor/;
use Moose;
-BEGIN { extends qw/Catalyst Catalyst::Controller/ } # Ewww, FIXME.
+extends qw/Catalyst/;
-sub foo : Local {
- my ($self, $c) = @_;
- $c->res->body('foo');
-}
-
__PACKAGE__->setup;
our $MODIFIER_FIRED = 0;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppStats (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppStats)
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppStats/Controller (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppStats/Controller)
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppStats/Controller/Root.pm
===================================================================
--- Catalyst-Runtime/5.80/trunk/t/lib/TestAppStats/Controller/Root.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppStats/Controller/Root.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,16 +0,0 @@
-package TestAppStats::Controller::Root;
-use strict;
-use warnings;
-use base 'Catalyst::Controller';
-
-__PACKAGE__->config->{namespace} = '';
-
-# Return log messages from previous request
-sub default : Private {
- my ( $self, $c ) = @_;
- $c->stats->profile("test");
- $c->res->body(join("\n", @TestAppStats::log_messages));
- @TestAppStats::log_messages = ();
-}
-
-1;
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppStats/Controller/Root.pm (from rev 12002, Catalyst-Runtime/5.80/trunk/t/lib/TestAppStats/Controller/Root.pm)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppStats/Controller/Root.pm (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppStats/Controller/Root.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,16 @@
+package TestAppStats::Controller::Root;
+use strict;
+use warnings;
+use base 'Catalyst::Controller';
+
+__PACKAGE__->config->{namespace} = '';
+
+# Return log messages from previous request
+sub default : Private {
+ my ( $self, $c ) = @_;
+ $c->stats->profile("test");
+ $c->res->body(join("\n", @TestAppStats::log_messages));
+ @TestAppStats::log_messages = ();
+}
+
+1;
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppStats.pm
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppStats.pm 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/lib/TestAppStats.pm 2009-11-24 17:19:15 UTC (rev 12003)
@@ -16,16 +16,11 @@
__PACKAGE__->setup;
-# Return log messages from previous request
-sub default : Private {
- my ( $self, $c ) = @_;
- $c->stats->profile("test");
- $c->res->body(join("\n", @log_messages));
- @log_messages = ();
-}
-
package TestAppStats::Log;
use base qw/Catalyst::Log/;
-sub info { push(@log_messages, @_); }
-sub debug { push(@log_messages, @_); }
+sub info { push(@TestAppStats::log_messages, @_); }
+sub debug { push(@TestAppStats::log_messages, @_); }
+
+1;
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_action.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_action.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_action.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_action.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,110 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 28 * $iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ ok( my $response = request('http://localhost/action_action_one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action_action_one', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Action',
+ 'Test Class'
+ );
+ is( $response->header('X-Action'), 'works' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action_action_two'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action_action_two', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Action',
+ 'Test Class'
+ );
+ is( $response->header('X-Action-After'), 'awesome' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok(
+ my $response =
+ request('http://localhost/action_action_three/one/two'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action_action_three', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Action',
+ 'Test Class'
+ );
+ is( $response->header('X-TestAppActionTestBefore'), 'one' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action_action_four'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action_action_four', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Action',
+ 'Test Class'
+ );
+ is( $response->header('X-TestAppActionTestMyAction'), 'MyAction works' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_auto.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_auto.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_auto.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_auto.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,136 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 18*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+
+ # new dispatcher:
+ # 11 wallclock secs (10.14 usr + 0.20 sys = 10.34 CPU) @ 15.18/s (n=157)
+ # old dispatcher (r1486):
+ # 11 wallclock secs (10.34 usr + 0.20 sys = 10.54 CPU) @ 13.76/s (n=145)
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ # test auto + local method
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Auto->begin
+ TestApp::Controller::Action::Auto->auto
+ TestApp::Controller::Action::Auto->one
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/auto/one'), 'auto + local' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'one', 'Content OK' );
+ }
+
+ # test auto + default
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Auto->begin
+ TestApp::Controller::Action::Auto->auto
+ TestApp::Controller::Action::Auto->default
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/auto/anything'), 'auto + default' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'default', 'Content OK' );
+ }
+
+ # test auto + auto + local
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Auto::Deep->begin
+ TestApp::Controller::Action::Auto->auto
+ TestApp::Controller::Action::Auto::Deep->auto
+ TestApp::Controller::Action::Auto::Deep->one
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/auto/deep/one'), 'auto + auto + local' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'deep one', 'Content OK' );
+ }
+
+ # test auto + auto + default
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Auto::Deep->begin
+ TestApp::Controller::Action::Auto->auto
+ TestApp::Controller::Action::Auto::Deep->auto
+ TestApp::Controller::Action::Auto::Deep->default
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/auto/deep/anything'), 'auto + auto + default' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'deep default', 'Content OK' );
+ }
+
+ # test auto + failing auto + local + end
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Auto::Abort->begin
+ TestApp::Controller::Action::Auto->auto
+ TestApp::Controller::Action::Auto::Abort->auto
+ TestApp::Controller::Action::Auto::Abort->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/auto/abort/one'), 'auto + failing auto + local' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'abort end', 'Content OK' );
+ }
+
+ # test auto + default (bug on invocation of default twice)
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Auto::Default->begin
+ TestApp::Controller::Action::Auto->auto
+ TestApp::Controller::Action::Auto::Default->auto
+ TestApp::Controller::Action::Auto::Default->default
+ TestApp::Controller::Action::Auto::Default->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/auto/default/moose'), 'auto + default' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'default (auto: 1)', 'Content OK' );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_auto_doublebug.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_auto_doublebug.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_auto_doublebug.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_auto_doublebug.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,41 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+
+use Test::More tests => 3*$iters;
+use Catalyst::Test 'TestAppDoubleAutoBug';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ my @expected = qw[
+ TestAppDoubleAutoBug->auto
+ TestAppDoubleAutoBug->default
+ TestAppDoubleAutoBug->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/auto/one'), 'auto + local' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'default, auto=1', 'Content OK' );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_begin.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_begin.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_begin.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_begin.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,53 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 7*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Begin->begin
+ TestApp::Controller::Action::Begin->default
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/begin'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Begin',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ like( $response->content, qr/'Catalyst::Request'/,
+ 'Content is a serialized Catalyst::Request' );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_chained.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_chained.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_chained.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_chained.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,831 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 118*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests($_);
+ }
+}
+
+sub run_tests {
+ my ($run_number) = @_;
+
+ #
+ # This is a simple test where the parent and child actions are
+ # within the same controller.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->foo
+ TestApp::Controller::Action::Chained->endpoint
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/foo/1/end/2'), 'chained + local endpoint' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # This makes sure the above isn't found if the argument for the
+ # end action isn't supplied.
+ #
+ {
+ my $expected = undef;
+
+ ok( my $response = request('http://localhost/chained/foo/1/end'),
+ 'chained + local endpoint; missing last argument' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->code, 500, 'Status OK' );
+ }
+
+ #
+ # Tests the case when the child action is placed in a subcontroller.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->foo
+ TestApp::Controller::Action::Chained::Foo->spoon
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/foo/1/spoon'), 'chained + subcontroller endpoint' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; ', 'Content OK' );
+ }
+
+ #
+ # Tests if the relative specification (e.g.: Chained('bar') ) works
+ # as expected.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->bar
+ TestApp::Controller::Action::Chained->finale
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/bar/1/spoon'), 'chained + relative endpoint' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 1, spoon', 'Content OK' );
+ }
+
+ #
+ # Just a test for multiple arguments.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->foo2
+ TestApp::Controller::Action::Chained->endpoint2
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/foo2/10/20/end2/15/25'),
+ 'chained + local (2 args each)' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '10, 20; 15, 25', 'Content OK' );
+ }
+
+ #
+ # The first three-chain test tries to call the action with :Args(1)
+ # specification. There's also a one action with a :CaptureArgs(1)
+ # attribute, that should not be dispatched to.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->one_end
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/one/23'),
+ 'three-chain (only first)' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 23', 'Content OK' );
+ }
+
+ #
+ # This is the second three-chain test, it goes for the action that
+ # handles "/one/$cap/two/$arg1/$arg2" paths. Should be the two action
+ # having :Args(2), not the one having :CaptureArgs(2).
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->one
+ TestApp::Controller::Action::Chained->two_end
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/one/23/two/23/46'),
+ 'three-chain (up to second)' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '23; 23, 46', 'Content OK' );
+ }
+
+ #
+ # Last of the three-chain tests. Has no concurrent action with :CaptureArgs
+ # and is more thought to simply test the chain as a whole and the 'two'
+ # action specifying :CaptureArgs.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->one
+ TestApp::Controller::Action::Chained->two
+ TestApp::Controller::Action::Chained->three_end
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/one/23/two/23/46/three/1/2/3'),
+ 'three-chain (all three)' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '23, 23, 46; 1, 2, 3', 'Content OK' );
+ }
+
+ #
+ # Tests dispatching on number of arguments for :Args. This should be
+ # dispatched to the action expecting one argument.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->multi1
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/multi/23'),
+ 'multi-action (one arg)' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 23', 'Content OK' );
+ }
+
+ #
+ # Belongs to the former test and goes for the action expecting two arguments.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->multi2
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/multi/23/46'),
+ 'multi-action (two args)' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 23, 46', 'Content OK' );
+ }
+
+ #
+ # Dispatching on argument count again, this time we provide too many
+ # arguments, so dispatching should fail.
+ #
+ {
+ my $expected = undef;
+
+ ok( my $response = request('http://localhost/chained/multi/23/46/67'),
+ 'multi-action (three args, should lead to error)' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->code, 500, 'Status OK' );
+ }
+
+ #
+ # This tests the case when an action says it's the child of an action in
+ # a subcontroller.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::Foo->higher_root
+ TestApp::Controller::Action::Chained->higher_root
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/higher_root/23/bar/11'),
+ 'root higher than child' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '23; 11', 'Content OK' );
+ }
+
+ #
+ # Just a more complex version of the former test. It tests if a controller ->
+ # subcontroller -> controller dispatch works.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->pcp1
+ TestApp::Controller::Action::Chained::Foo->pcp2
+ TestApp::Controller::Action::Chained->pcp3
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/pcp1/1/pcp2/2/pcp3/3'),
+ 'parent -> child -> parent' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1, 2; 3', 'Content OK' );
+ }
+
+ #
+ # Tests dispatch on capture number. This test is for a one capture action.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->multi_cap1
+ TestApp::Controller::Action::Chained->multi_cap_end1
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/multi_cap/1/baz'),
+ 'dispatch on capture num 1' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; ', 'Content OK' );
+ }
+
+ #
+ # Belongs to the former test. This one goes for the action expecting two
+ # captures.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->multi_cap2
+ TestApp::Controller::Action::Chained->multi_cap_end2
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/multi_cap/1/2/baz'),
+ 'dispatch on capture num 2' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1, 2; ', 'Content OK' );
+ }
+
+ #
+ # Tests the priority of a slurpy arguments action (with :Args) against
+ # two actions chained together. The two actions should win.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->priority_a2
+ TestApp::Controller::Action::Chained->priority_a2_end
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/priority_a/1/end/2'),
+ 'priority - slurpy args vs. parent/child' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # This belongs to the former test but tests if two chained actions have
+ # priority over an action with the exact arguments.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->priority_b2
+ TestApp::Controller::Action::Chained->priority_b2_end
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/priority_b/1/end/2'),
+ 'priority - fixed args vs. parent/child' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # This belongs to the former test but tests if two chained actions have
+ # priority over an action with one child action not having the Args() attr set.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->priority_c1
+ TestApp::Controller::Action::Chained->priority_c2_xyz
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/priority_c/1/xyz/'),
+ 'priority - no Args() order mismatch' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; ', 'Content OK' );
+ }
+
+ #
+ # Test dispatching between two controllers that are on the same level and
+ # therefor have no parent/child relationship.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::Bar->cross1
+ TestApp::Controller::Action::Chained::Foo->cross2
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/cross/1/end/2'),
+ 'cross controller w/o par/child relation' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # This is for testing if the arguments got passed to the actions
+ # correctly.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::PassedArgs->first
+ TestApp::Controller::Action::Chained::PassedArgs->second
+ TestApp::Controller::Action::Chained::PassedArgs->third
+ TestApp::Controller::Action::Chained::PassedArgs->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/passedargs/a/1/b/2/c/3'),
+ 'Correct arguments passed to actions' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2; 3', 'Content OK' );
+ }
+
+ #
+ # The :Args attribute is optional, we check the action not specifying
+ # it with these tests.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->opt_args
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/opt_args/1/2/3'),
+ 'Optional :Args attribute working' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 1, 2, 3', 'Content OK' );
+ }
+
+ #
+ # Tests for optional PathPart attribute.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->opt_pp_start
+ TestApp::Controller::Action::Chained->opt_pathpart
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/optpp/1/opt_pathpart/2'),
+ 'Optional :PathName attribute working' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Tests for optional PathPart *and* Args attributes.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->opt_all_start
+ TestApp::Controller::Action::Chained->oa
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/optall/1/oa/2/3'),
+ 'Optional :PathName *and* :Args attributes working' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2, 3', 'Content OK' );
+ }
+
+ #
+ # Test if :Chained is the same as :Chained('/')
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->rootdef
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/rootdef/23'),
+ ":Chained is the same as :Chained('/')" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; 23', 'Content OK' );
+ }
+
+ #
+ # Test if :Chained('.') is working
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->parentchain
+ TestApp::Controller::Action::Chained::ParentChain->child
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/parentchain/1/child/2'),
+ ":Chained('.') chains to parent controller action" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Test behaviour of auto actions returning '1' for the chain.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::Auto->auto
+ TestApp::Controller::Action::Chained::Auto::Foo->auto
+ TestApp::Controller::Action::Chained::Auto->foo
+ TestApp::Controller::Action::Chained::Auto::Foo->fooend
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/autochain1/1/fooend/2'),
+ "Behaviour when auto returns 1 correct" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Test behaviour of auto actions returning '0' for the chain.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::Auto->auto
+ TestApp::Controller::Action::Chained::Auto::Bar->auto
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/autochain2/1/barend/2'),
+ "Behaviour when auto returns 0 correct" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Test what auto actions are run when namespaces are changed
+ # horizontally.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::Auto->auto
+ TestApp::Controller::Action::Chained::Auto::Foo->auto
+ TestApp::Controller::Action::Chained::Auto::Bar->crossloose
+ TestApp::Controller::Action::Chained::Auto::Foo->crossend
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/auto_cross/1/crossend/2'),
+ "Correct auto actions are run on cross controller dispatch" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Test forwarding from auto action in chain dispatch.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::Auto->auto
+ TestApp::Controller::Action::Chained::Auto::Forward->auto
+ TestApp::Controller::Action::Chained::Auto->fw3
+ TestApp::Controller::Action::Chained::Auto->fw1
+ TestApp::Controller::Action::Chained::Auto::Forward->forwardend
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/auto_forward/1/forwardend/2'),
+ "Forwarding out of auto in chain" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Detaching out of the auto action of a chain.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained::Auto->auto
+ TestApp::Controller::Action::Chained::Auto::Detach->auto
+ TestApp::Controller::Action::Chained::Auto->fw3
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/auto_detach/1/detachend/2'),
+ "Detaching out of auto in chain" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Test forwarding from auto action in chain dispatch.
+ #
+ {
+ my $expected = undef;
+
+ ok( my $response = request('http://localhost/chained/loose/23'),
+ "Loose end is not callable" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->code, 500, 'Status OK' );
+ }
+
+ #
+ # Test forwarding out of a chain.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->chain_fw_a
+ TestApp::Controller::Action::Chained->fw_dt_target
+ TestApp::Controller::Action::Chained->chain_fw_b
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/chain_fw/1/end/2'),
+ "Forwarding out a chain" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Test detaching out of a chain.
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->chain_dt_a
+ TestApp::Controller::Action::Chained->fw_dt_target
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/chain_dt/1/end/2'),
+ "Forwarding out a chain" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '1; 2', 'Content OK' );
+ }
+
+ #
+ # Tests that an uri_for to a chained root index action
+ # returns the right value.
+ #
+ {
+ ok( my $response = request(
+ 'http://localhost/action/chained/to_root' ),
+ 'uri_for with chained root action as arg' );
+ like( $response->content,
+ qr(URI:https?://[^/]+/),
+ 'Correct URI generated' );
+ }
+
+ #
+ # Test interception of recursive chains. This test was added because at
+ # one point during the :Chained development, Catalyst used to hang on
+ # recursive chains.
+ #
+ {
+ eval { require 'TestAppChainedRecursive.pm' };
+ if ($run_number == 1) {
+ ok( ! $@, "Interception of recursive chains" );
+ }
+ else { pass( "Interception of recursive chains already tested" ) }
+ }
+
+ #
+ # Test failure of absolute path part arguments.
+ #
+ {
+ eval { require 'TestAppChainedAbsolutePathPart.pm' };
+ if ($run_number == 1) {
+ like( $@, qr(foo/foo),
+ "Usage of absolute path part argument emits error" );
+ }
+ else { pass( "Error on absolute path part arguments already tested" ) }
+ }
+
+ #
+ # Test chained actions in the root controller
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained::Root->rootsub
+ TestApp::Controller::Action::Chained::Root->endpointsub
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/rootsub/1/endpointsub/2'), 'chained in root namespace' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '', 'Content OK' );
+ }
+
+ #
+ # Complex path with multiple empty pathparts
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->mult_nopp_base
+ TestApp::Controller::Action::Chained->mult_nopp_all
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/chained/mult_nopp'),
+ "Complex path with multiple empty pathparts" );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, '; ', 'Content OK' );
+ }
+
+ #
+ # Higher Args() hiding more specific CaptureArgs chains sections
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->cc_base
+ TestApp::Controller::Action::Chained->cc_link
+ TestApp::Controller::Action::Chained->cc_anchor
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join ', ', @expected;
+
+ ok( my $response = request('http://localhost/chained/choose_capture/anchor.html'),
+ 'Choose between an early Args() and a later more ideal chain' );
+ is( $response->header('X-Catalyst-Executed') => $expected, 'Executed actions');
+ is( $response->content => '; ', 'Content OK' );
+ }
+
+ #
+ # Less specific chain not being seen correctly due to earlier looser capture
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->cc_base
+ TestApp::Controller::Action::Chained->cc_b
+ TestApp::Controller::Action::Chained->cc_b_link
+ TestApp::Controller::Action::Chained->cc_b_anchor
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join ', ', @expected;
+
+ ok( my $response = request('http://localhost/chained/choose_capture/b/a/anchor.html'),
+ 'Choose between a more specific chain and an earlier looser one' );
+ is( $response->header('X-Catalyst-Executed') => $expected, 'Executed actions');
+ is( $response->content => 'a; ', 'Content OK' );
+ }
+
+ #
+ # Check we get the looser one when it's the correct match
+ #
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Chained->begin
+ TestApp::Controller::Action::Chained->cc_base
+ TestApp::Controller::Action::Chained->cc_a
+ TestApp::Controller::Action::Chained->cc_a_link
+ TestApp::Controller::Action::Chained->cc_a_anchor
+ TestApp::Controller::Action::Chained->end
+ ];
+
+ my $expected = join ', ', @expected;
+
+ ok( my $response = request('http://localhost/chained/choose_capture/a/a/anchor.html'),
+ 'Choose between a more specific chain and an earlier looser one' );
+ is( $response->header('X-Catalyst-Executed') => $expected, 'Executed actions');
+ is( $response->content => 'a; anchor.html', 'Content OK' );
+ }
+
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_default.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_default.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_default.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_default.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,96 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 16 * $iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Default->begin
+ TestApp::Controller::Action::Default->default
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/default'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Default',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+
+ ok( $response = request('http://localhost/foo/bar/action'), 'Request' );
+ is( $response->code, 500, 'Invalid URI returned 500' );
+ }
+
+ # test that args are passed properly to default
+ {
+ my $creq;
+ my $expected = [qw/action default arg1 arg2/];
+
+ ok( my $response = request('http://localhost/action/default/arg1/arg2'),
+ 'Request' );
+ ok(
+ eval '$creq = ' . $response->content,
+ 'Unserialize Catalyst::Request'
+ );
+ is_deeply( $creq->{arguments}, $expected, 'Arguments ok' );
+ }
+
+
+ # Test that /foo and /foo/ both do the same thing
+ {
+ my @expected = qw[
+ TestApp::Controller::Action->begin
+ TestApp::Controller::Action->default
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action'), 'Request' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected,
+ 'Executed actions for /action'
+ );
+
+ ok( $response = request('http://localhost/action/'), 'Request' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected,
+ 'Executed actions for /action/'
+ );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_detach.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_detach.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_detach.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_detach.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,100 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 18*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Detach->begin
+ TestApp::Controller::Action::Detach->one
+ TestApp::Controller::Action::Detach->two
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ # Test detach to chain of actions.
+ ok( my $response = request('http://localhost/action/detach/one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/detach/one', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Detach',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ }
+
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Detach->begin
+ TestApp::Controller::Action::Detach->path
+ TestApp::Controller::Action::Detach->two
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ # Test detach to chain of actions.
+ ok( my $response = request('http://localhost/action/detach/path'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/detach/path', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Detach',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ }
+
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/detach/with_args/old'),
+ 'Request with args'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'new' );
+ }
+
+ {
+ ok(
+ my $response = request(
+ 'http://localhost/action/detach/with_method_and_args/old'),
+ 'Request with args and method'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'new' );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_end.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_end.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_end.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_end.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,54 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 7*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::End->begin
+ TestApp::Controller::Action::End->default
+ TestApp::View::Dump::Request->process
+ TestApp::Controller::Action::End->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/end'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::End',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_forward.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_forward.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_forward.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_forward.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,238 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 47 * $iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Forward->begin
+ TestApp::Controller::Action::Forward->one
+ TestApp::Controller::Action::Forward->two
+ TestApp::Controller::Action::Forward->three
+ TestApp::Controller::Action::Forward->four
+ TestApp::Controller::Action::Forward->five
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ # Test forward to global private action
+ ok( my $response = request('http://localhost/action/forward/global'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/forward/global', 'Main Class Action' );
+
+ # Test forward to chain of actions.
+ ok( $response = request('http://localhost/action/forward/one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/forward/one', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Forward',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Forward->begin
+ TestApp::Controller::Action::Forward->jojo
+ TestApp::Controller::Action::Forward->one
+ TestApp::Controller::Action::Forward->two
+ TestApp::Controller::Action::Forward->three
+ TestApp::Controller::Action::Forward->four
+ TestApp::Controller::Action::Forward->five
+ TestApp::View::Dump::Request->process
+ TestApp::Controller::Action::Forward->three
+ TestApp::Controller::Action::Forward->four
+ TestApp::Controller::Action::Forward->five
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/forward/jojo'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/forward/jojo', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Forward',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/forward/with_args/old'),
+ 'Request with args'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'old' );
+ }
+
+ {
+ ok(
+ my $response = request(
+ 'http://localhost/action/forward/with_method_and_args/old'),
+ 'Request with args and method'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'old' );
+ }
+
+ # test forward with embedded args
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/forward/args_embed_relative'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'ok' );
+ }
+
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/forward/args_embed_absolute'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content, 'ok' );
+ }
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::TestRelative->begin
+ TestApp::Controller::Action::TestRelative->relative
+ TestApp::Controller::Action::Forward->one
+ TestApp::Controller::Action::Forward->two
+ TestApp::Controller::Action::Forward->three
+ TestApp::Controller::Action::Forward->four
+ TestApp::Controller::Action::Forward->five
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ # Test forward to chain of actions.
+ ok( my $response = request('http://localhost/action/relative/relative'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/relative/relative', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::TestRelative',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::TestRelative->begin
+ TestApp::Controller::Action::TestRelative->relative_two
+ TestApp::Controller::Action::Forward->one
+ TestApp::Controller::Action::Forward->two
+ TestApp::Controller::Action::Forward->three
+ TestApp::Controller::Action::Forward->four
+ TestApp::Controller::Action::Forward->five
+ TestApp::View::Dump::Request->process
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ # Test forward to chain of actions.
+ ok(
+ my $response =
+ request('http://localhost/action/relative/relative_two'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is(
+ $response->header('X-Catalyst-Action'),
+ 'action/relative/relative_two',
+ 'Test Action'
+ );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::TestRelative',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ # test class forwards
+ {
+ ok(
+ my $response = request(
+ 'http://localhost/action/forward/class_forward_test_action'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header('X-Class-Forward-Test-Method'), 1,
+ 'Test Method' );
+ }
+
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_global.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_global.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_global.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_global.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,83 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 18*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ ok( my $response = request('http://localhost/action_global_one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action_global_one', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Global',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action_global_two'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action_global_two', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Global',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action_global_three'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action_global_three', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Global',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_index.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_index.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_index.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_index.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,100 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 20*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ # test root index
+ {
+ my @expected = qw[
+ TestApp->index
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+ ok( my $response = request('http://localhost/'), 'root index' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'root index', 'root index ok' );
+
+ ok( $response = request('http://localhost'), 'root index no slash' );
+ is( $response->content, 'root index', 'root index no slash ok' );
+ }
+
+ # test first-level controller index
+ {
+ my @expected = qw[
+ TestApp::Controller::Index->index
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/index/'), 'first-level controller index' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'Index index', 'first-level controller index ok' );
+
+ ok( $response = request('http://localhost/index'), 'first-level controller index no slash' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'Index index', 'first-level controller index no slash ok' );
+ }
+
+ # test second-level controller index
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Index->begin
+ TestApp::Controller::Action::Index->index
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/index/'), 'second-level controller index' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'Action-Index index', 'second-level controller index ok' );
+
+ ok( $response = request('http://localhost/action/index'), 'second-level controller index no slash' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, 'Action-Index index', 'second-level controller index no slash ok' );
+ }
+
+ # test controller default when index is present
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Index->begin
+ TestApp::Controller::Action::Index->default
+ TestApp->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/index/foo'), 'default with index' );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ is( $response->content, "Error - TestApp::Controller::Action\n", 'default with index ok' );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_inheritance.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_inheritance.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_inheritance.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_inheritance.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,119 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 21*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Inheritance->begin
+ TestApp::Controller::Action::Inheritance->auto
+ TestApp::Controller::Action::Inheritance->default
+ TestApp::View::Dump::Request->process
+ TestApp::Controller::Action::Inheritance->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/inheritance'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Inheritance',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Inheritance::A->begin
+ TestApp::Controller::Action::Inheritance->auto
+ TestApp::Controller::Action::Inheritance::A->auto
+ TestApp::Controller::Action::Inheritance::A->default
+ TestApp::View::Dump::Request->process
+ TestApp::Controller::Action::Inheritance::A->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/inheritance/a'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Inheritance::A',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ my @expected = qw[
+ TestApp::Controller::Action::Inheritance::A::B->begin
+ TestApp::Controller::Action::Inheritance->auto
+ TestApp::Controller::Action::Inheritance::A->auto
+ TestApp::Controller::Action::Inheritance::A::B->auto
+ TestApp::Controller::Action::Inheritance::A::B->default
+ TestApp::View::Dump::Request->process
+ TestApp::Controller::Action::Inheritance::A::B->end
+ ];
+
+ my $expected = join( ", ", @expected );
+
+ ok( my $response = request('http://localhost/action/inheritance/a/b'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'), 'default', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Inheritance::A::B',
+ 'Test Class'
+ );
+ is( $response->header('X-Catalyst-Executed'),
+ $expected, 'Executed actions' );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_local.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_local.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_local.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_local.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,138 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 32*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ ok( my $response = request('http://localhost/action/local/one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/local/one', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Local',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/local/two/1/2'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/local/two', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Local',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/local/two'),
+ 'Request' );
+ ok( !$response->is_success, 'Request with wrong number of args failed' );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/local/three'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/local/three', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Local',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/local/four/five/six'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/local/four/five/six', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Local',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip "tests for %2F on remote server", 6;
+ }
+
+ ok(
+ my $response =
+ request('http://localhost/action/local/one/foo%2Fbar'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/local/one', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Local',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr~arguments => \[\s*'foo/bar'\s*\]~,
+ "Parameters don't split on %2F"
+ );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_multipath.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_multipath.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_multipath.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_multipath.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,71 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+my $content = q/foo
+bar
+baz
+/;
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 16*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ # Local
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/multipath/multipath'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->content, $content, 'Content is a stream' );
+ }
+
+ # Global
+ {
+ ok( my $response = request('http://localhost/multipath'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->content, $content, 'Content is a stream' );
+ }
+
+ # Path('/multipath1')
+ {
+ ok( my $response = request('http://localhost/multipath1'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->content, $content, 'Content is a stream' );
+ }
+
+ # Path('multipath2')
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/multipath/multipath2'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->content, $content, 'Content is a stream' );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_path.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_path.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_path.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_path.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,127 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 30*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ ok(
+ my $response =
+ request('http://localhost/action/path/a%20path%20with%20spaces'),
+ 'Request'
+ );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is(
+ $response->header('X-Catalyst-Action'),
+ 'action/path/a%20path%20with%20spaces',
+ 'Test Action'
+ );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Path',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/path/åäö'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/path/%C3%A5%C3%A4%C3%B6', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Path',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/path/'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/path', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Path',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/path/spaces_near_parens_singleq'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/path/spaces_near_parens_singleq', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Path',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/path/spaces_near_parens_doubleq'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'action/path/spaces_near_parens_doubleq', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Path',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_private.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_private.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_private.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_private.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,89 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 24*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ ok( my $response = request('http://localhost/action/private/one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Private',
+ 'Test Class'
+ );
+ is( $response->content, 'access denied', 'Access' );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/private/two'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Private',
+ 'Test Class'
+ );
+ is( $response->content, 'access denied', 'Access' );
+ }
+
+ {
+ ok( my $response = request('http://localhost/three'), 'Request' );
+ ok( $response->is_error, 'Response Server Error 5xx' );
+ is( $response->content_type, 'text/html', 'Response Content-Type' );
+ like(
+ $response->header('X-Catalyst-Error'),
+ qr/^Unknown resource "three"/,
+ 'Catalyst Error'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/private/four'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Private',
+ 'Test Class'
+ );
+ is( $response->content, 'access denied', 'Access' );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/private/five'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Private',
+ 'Test Class'
+ );
+ is( $response->content, 'access denied', 'Access' );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_regexp.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_regexp.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_regexp.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_regexp.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,106 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 28*$iters;
+use Catalyst::Test 'TestApp';
+
+use Catalyst::Request;
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ {
+ ok( my $response = request('http://localhost/action/regexp/10/hello'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ '^action/regexp/(\d+)/(\w+)$', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Regexp',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/regexp/hello/10'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ '^action/regexp/(\w+)/(\d+)$', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Regexp',
+ 'Test Class'
+ );
+ like(
+ $response->content,
+ qr/^bless\( .* 'Catalyst::Request' \)$/s,
+ 'Content is a serialized Catalyst::Request'
+ );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/regexp/mandatory'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ '^action/regexp/(mandatory)(/optional)?$', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Regexp',
+ 'Test Class'
+ );
+ my $content = $response->content;
+ my $req = eval $content;
+
+ is( scalar @{ $req->captures }, 2, 'number of captures' );
+ is( $req->captures->[ 0 ], 'mandatory', 'mandatory capture' );
+ ok( !defined $req->captures->[ 1 ], 'optional capture' );
+ }
+
+ {
+ ok( my $response = request('http://localhost/action/regexp/mandatory/optional'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ '^action/regexp/(mandatory)(/optional)?$', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Regexp',
+ 'Test Class'
+ );
+ my $content = $response->content;
+ my $req = eval $content;
+
+ is( scalar @{ $req->captures }, 2, 'number of captures' );
+ is( $req->captures->[ 0 ], 'mandatory', 'mandatory capture' );
+ is( $req->captures->[ 1 ], '/optional', 'optional capture' );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_streaming.t (from rev 4483, trunk/Catalyst/t/live_component_controller_action_streaming.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_streaming.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_action_streaming.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,72 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
+
+use Test::More tests => 10*$iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ # test direct streaming
+ {
+ ok( my $response = request('http://localhost/streaming'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip "Using remote server", 1;
+ }
+
+ # XXX: Length should be undef here, but HTTP::Request::AsCGI sets it
+ is( $response->content_length, 12, 'Response Content-Length' );
+ }
+
+ is( $response->content,, <<'EOF', 'Content is a stream' );
+foo
+bar
+baz
+EOF
+ }
+
+ # test streaming by passing a handle to $c->res->body
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip "Using remote server", 5;
+ }
+
+ my $file = "$FindBin::Bin/01use.t";
+ my $fh = IO::File->new( $file, 'r' );
+ my $buffer;
+ if ( defined $fh ) {
+ $fh->read( $buffer, 1024 );
+ $fh->close;
+ }
+
+ ok( my $response = request('http://localhost/action/streaming/body'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->content_length, -s $file, 'Response Content-Length' );
+ is( $response->content, $buffer, 'Content is read from filehandle' );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_args.t (from rev 4483, trunk/Catalyst/t/live_component_controller_args.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_args.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_component_controller_args.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,98 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use URI::Escape;
+
+our @paths;
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1;
+
+ # add special paths to test here
+ @paths = (
+ # all reserved in uri's
+ qw~ : / ? [ ] @ ! $ & ' ( ) * + ; = ~, ',' , '#',
+
+ # unreserved
+ 'a'..'z','A'..'Z',0..9,qw( - . _ ~ ),
+ " ",
+
+ # just to test %2F/%
+ [ qw~ / / ~ ],
+
+ # testing %25/%25
+ [ qw~ % % ~ ],
+ );
+}
+
+use Test::More tests => 6*@paths * $iters;
+use Catalyst::Test 'TestApp';
+
+if ( $ENV{CAT_BENCHMARK} ) {
+ require Benchmark;
+ Benchmark::timethis( $iters, \&run_tests );
+
+ # new dispatcher:
+ # 11 wallclock secs (10.14 usr + 0.20 sys = 10.34 CPU) @ 15.18/s (n=157)
+ # old dispatcher (r1486):
+ # 11 wallclock secs (10.34 usr + 0.20 sys = 10.54 CPU) @ 13.76/s (n=145)
+}
+else {
+ for ( 1 .. $iters ) {
+ run_tests();
+ }
+}
+
+sub run_tests {
+ run_test_for($_) for @paths;
+}
+
+sub run_test_for {
+ my $test = shift;
+
+ my $path;
+ if (ref $test) {
+ $path = join "/", map uri_escape($_), @$test;
+ $test = join '', @$test;
+ } else {
+ $path = uri_escape($test);
+ }
+
+ SKIP:
+ {
+ # Skip %2F, ., [, (, and ) tests on real webservers
+ # Both Apache and lighttpd don't seem to like these
+ if ( $ENV{CATALYST_SERVER} && $path =~ /(?:%2F|\.|%5B|\(|\))/ ) {
+ skip "Skipping $path tests on remote server", 6;
+ }
+
+ my $response;
+
+ ok( $response = request("http://localhost/args/args/$path"), "Requested args for path $path");
+
+ is( $response->content, $test, "$test as args" );
+
+ undef $response;
+
+ ok( $response = request("http://localhost/args/params/$path"), "Requested params for path $path");
+
+ is( $response->content, $test, "$test as params" );
+
+ undef $response;
+
+ if( $test =~ m{/} ) {
+ $test =~ s{/}{}g;
+ $path = uri_escape( $test );
+ }
+
+ ok( $response = request("http://localhost/chained/multi_cap/$path/baz"), "Requested capture for path $path");
+
+ is( $response->content, join( ', ', split( //, $test ) ) ."; ", "$test as capture" );
+ }
+}
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_body.t (from rev 4483, trunk/Catalyst/t/live_engine_request_body.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_body.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_body.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,77 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 18;
+use Catalyst::Test 'TestApp';
+
+use Catalyst::Request;
+use HTTP::Headers;
+use HTTP::Request::Common;
+
+{
+ my $creq;
+
+ my $request = POST(
+ 'http://localhost/dump/request/',
+ 'Content-Type' => 'text/plain',
+ 'Content' => 'Hello Catalyst'
+ );
+
+ 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/'Catalyst::Request'/,
+ '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, 'text/plain', 'Catalyst::Request Content-Type' );
+ is( $creq->content_length, $request->content_length,
+ 'Catalyst::Request Content-Length' );
+}
+
+{
+ my $creq;
+
+ my $request = POST(
+ 'http://localhost/dump/request/',
+ 'Content-Type' => 'text/plain',
+ 'Content' => 'x' x 100_000
+ );
+
+ 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, 'text/plain', 'Catalyst::Request Content-Type' );
+ is( $creq->content_length, $request->content_length,
+ 'Catalyst::Request Content-Length' );
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_body_demand.t (from rev 6895, trunk/Catalyst-Runtime/t/live_engine_request_body_demand.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_body_demand.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_body_demand.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,66 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 8;
+use Catalyst::Test 'TestAppOnDemand';
+
+use Catalyst::Request;
+use HTTP::Headers;
+use HTTP::Request::Common;
+
+# Test a simple POST request to make sure body parsing
+# works in on-demand mode.
+SKIP:
+{
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip "Using remote server", 8;
+ }
+
+ {
+ my $params;
+
+ my $request = POST(
+ 'http://localhost/body/params',
+ 'Content-Type' => 'application/x-www-form-urlencoded',
+ 'Content' => 'foo=bar&baz=quux'
+ );
+
+ my $expected = { foo => 'bar', baz => 'quux' };
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+
+ {
+ no strict 'refs';
+ ok(
+ eval '$params = ' . $response->content,
+ 'Unserialize params'
+ );
+ }
+
+ is_deeply( $params, $expected, 'Catalyst::Request body parameters' );
+ }
+
+ # Test reading chunks of the request body using $c->read
+ {
+ my $creq;
+
+ my $request = POST(
+ 'http://localhost/body/read',
+ 'Content-Type' => 'text/plain',
+ 'Content' => 'x' x 105_000
+ );
+
+ my $expected = '10000|10000|10000|10000|10000|10000|10000|10000|10000|10000|5000';
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->content, $expected, 'Response Content' );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_cookies.t (from rev 4483, trunk/Catalyst/t/live_engine_request_cookies.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_cookies.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_cookies.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,45 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 13;
+use Catalyst::Test 'TestApp';
+
+use Catalyst::Request;
+use CGI::Simple::Cookie;
+use HTTP::Headers;
+use HTTP::Request::Common;
+use URI;
+
+{
+ my $creq;
+
+ my $request = GET( 'http://localhost/dump/request',
+ 'Cookie' => 'Catalyst=Cool; Cool=Catalyst', );
+
+ 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/'Catalyst::Request'/,
+ 'Content is a serialized Catalyst::Request' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ isa_ok( $creq, 'Catalyst::Request' );
+ isa_ok( $creq->cookies->{Catalyst}, 'CGI::Simple::Cookie',
+ 'Cookie Catalyst' );
+ is( $creq->cookies->{Catalyst}->name, 'Catalyst', 'Cookie Catalyst name' );
+ is( $creq->cookies->{Catalyst}->value, 'Cool', 'Cookie Catalyst value' );
+ isa_ok( $creq->cookies->{Cool}, 'CGI::Simple::Cookie', 'Cookie Cool' );
+ is( $creq->cookies->{Cool}->name, 'Cool', 'Cookie Cool name' );
+ is( $creq->cookies->{Cool}->value, 'Catalyst', 'Cookie Cool value' );
+
+ my $cookies = {
+ Catalyst => $creq->cookies->{Catalyst},
+ Cool => $creq->cookies->{Cool}
+ };
+
+ is_deeply( $creq->cookies, $cookies, 'Cookies' );
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_headers.t (from rev 4483, trunk/Catalyst/t/live_engine_request_headers.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_headers.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_headers.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,71 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 17;
+use Catalyst::Test 'TestApp';
+
+use Catalyst::Request;
+use HTTP::Headers;
+use HTTP::Request::Common;
+
+{
+ my $creq;
+
+ my $request = GET( 'http://localhost/dump/request',
+ 'User-Agent' => 'MyAgen/1.0',
+ 'X-Whats-Cool' => 'Catalyst',
+ 'X-Multiple' => [ 1 .. 5 ],
+ 'X-Forwarded-Host' => 'frontend.server.com',
+ 'X-Forwarded-For' => '192.168.1.1, 1.2.3.4',
+ );
+
+ 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' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ isa_ok( $creq, 'Catalyst::Request' );
+ isa_ok( $creq->headers, 'HTTP::Headers', 'Catalyst::Request->headers' );
+ is( $creq->header('X-Whats-Cool'), $request->header('X-Whats-Cool'), 'Catalyst::Request->header X-Whats-Cool' );
+
+ { # Test that multiple headers are joined as per RFC 2616 4.2 and RFC 3875 4.1.18
+
+ my $excpected = '1, 2, 3, 4, 5';
+ my $got = $creq->header('X-Multiple'); # HTTP::Headers is context sensitive, "force" scalar context
+
+ is( $got, $excpected, 'Multiple message-headers are joined as a comma-separated list' );
+ }
+
+ is( $creq->header('User-Agent'), $request->header('User-Agent'), 'Catalyst::Request->header User-Agent' );
+
+ my $host = sprintf( '%s:%d', $request->uri->host, $request->uri->port );
+ is( $creq->header('Host'), $host, 'Catalyst::Request->header Host' );
+
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} && $ENV{CATALYST_SERVER} !~ /127.0.0.1|localhost/ ) {
+ skip "Using remote server", 2;
+ }
+
+ is( $creq->base->host, 'frontend.server.com', 'Catalyst::Request proxied base' );
+ is( $creq->address, '1.2.3.4', 'Catalyst::Request proxied address' );
+ }
+
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip "Using remote server", 4;
+ }
+ # test that we can ignore the proxy support
+ TestApp->config->{ignore_frontend_proxy} = 1;
+ ok( $response = request($request), 'Request' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ is( $creq->base, 'http://localhost/', 'Catalyst::Request non-proxied base' );
+ is( $creq->address, '127.0.0.1', 'Catalyst::Request non-proxied address' );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_parameters.t (from rev 4483, trunk/Catalyst/t/live_engine_request_parameters.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_parameters.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_parameters.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,129 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 35;
+use Catalyst::Test 'TestApp';
+
+use Catalyst::Request;
+use HTTP::Headers;
+use HTTP::Request::Common;
+
+{
+ my $creq;
+
+ my $parameters = { 'a' => [qw(A b C d E f G)], };
+
+ my $query = join( '&', map { 'a=' . $_ } @{ $parameters->{a} } );
+
+ ok( my $response = request("http://localhost/dump/request?$query"),
+ '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'
+ );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ isa_ok( $creq, 'Catalyst::Request' );
+ is( $creq->method, 'GET', 'Catalyst::Request method' );
+ is_deeply( $creq->{parameters}, $parameters,
+ 'Catalyst::Request parameters' );
+}
+
+{
+ my $creq;
+ ok( my $response = request("http://localhost/dump/request?q=foo%2bbar"),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ ok( eval '$creq = ' . $response->content );
+ is $creq->{parameters}->{q}, 'foo+bar', '%2b not double decoded';
+}
+
+{
+ my $creq;
+
+ my $parameters = {
+ 'a' => [qw(A b C d E f G)],
+ '%' => [ '%', '"', '& - &' ],
+ 'blank' => '',
+ };
+
+ my $request = POST(
+ 'http://localhost/dump/request/a/b?a=1&a=2&a=3',
+ 'Content' => $parameters,
+ 'Content-Type' => 'application/x-www-form-urlencoded'
+ );
+
+ unshift( @{ $parameters->{a} }, 1, 2, 3 );
+
+ 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'
+ );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ isa_ok( $creq, 'Catalyst::Request' );
+ is( $creq->method, 'POST', 'Catalyst::Request method' );
+ is_deeply( $creq->{parameters}, $parameters,
+ 'Catalyst::Request parameters' );
+ is_deeply( $creq->arguments, [qw(a b)], 'Catalyst::Request arguments' );
+ is_deeply( $creq->{uploads}, {}, 'Catalyst::Request uploads' );
+ is_deeply( $creq->cookies, {}, 'Catalyst::Request cookie' );
+}
+
+# http://dev.catalyst.perl.org/ticket/37
+# multipart/form-data parameters that contain 'http://'
+# was an HTTP::Message bug, but HTTP::Body handles it properly now
+{
+ my $creq;
+
+ my $parameters = {
+ 'url' => 'http://www.google.com',
+ 'blank' => '',
+ };
+
+ my $request = POST( 'http://localhost/dump/request',
+ 'Content-Type' => 'multipart/form-data',
+ 'Content' => $parameters,
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ is_deeply( $creq->{parameters}, $parameters, 'Catalyst::Request parameters' );
+}
+
+# raw query string support
+{
+ my $creq;
+
+ my $parameters = {
+ a => 1,
+ blank => '',
+ };
+
+ my $request = POST(
+ 'http://localhost/dump/request/a/b?query+string',
+ 'Content' => $parameters,
+ 'Content-Type' => 'application/x-www-form-urlencoded'
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ is( $creq->{uri}->query, 'query+string', 'Catalyst::Request POST query_string' );
+ is( $creq->query_keywords, 'query string', 'Catalyst::Request query_keywords' );
+ is_deeply( $creq->{parameters}, $parameters, 'Catalyst::Request parameters' );
+
+ ok( $response = request('http://localhost/dump/request/a/b?x=1&y=1&z=1'), 'Request' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ is( $creq->{uri}->query, 'x=1&y=1&z=1', 'Catalyst::Request GET query_string' );
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_uploads.t (from rev 4483, trunk/Catalyst/t/live_engine_request_uploads.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_uploads.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_uploads.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,244 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 75;
+use Catalyst::Test 'TestApp';
+
+use Catalyst::Request;
+use Catalyst::Request::Upload;
+use HTTP::Headers;
+use HTTP::Headers::Util 'split_header_words';
+use HTTP::Request::Common;
+
+{
+ my $creq;
+
+ my $request = POST(
+ 'http://localhost/dump/request/',
+ 'Content-Type' => 'form-data',
+ 'Content' => [
+ 'live_engine_request_cookies.t' =>
+ ["$FindBin::Bin/live_engine_request_cookies.t"],
+ 'live_engine_request_headers.t' =>
+ ["$FindBin::Bin/live_engine_request_headers.t"],
+ 'live_engine_request_uploads.t' =>
+ ["$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] };
+
+ my $upload = $creq->{uploads}->{ $parameters{filename} };
+
+ isa_ok( $upload, 'Catalyst::Request::Upload' );
+
+ is( $upload->type, $part->content_type, 'Upload Content-Type' );
+ is( $upload->size, length( $part->content ), 'Upload Content-Length' );
+
+ # make sure upload is accessible via legacy params->{$file}
+ is( $creq->{parameters}->{ $upload->filename },
+ $upload->filename, 'legacy param method ok' );
+
+ ok( !-e $upload->tempname, 'Upload temp file was deleted' );
+ }
+}
+
+{
+ my $creq;
+
+ my $request = POST(
+ 'http://localhost/dump/request/',
+ 'Content-Type' => 'multipart/form-data',
+ 'Content' => [
+ 'testfile' => ["$FindBin::Bin/live_engine_request_cookies.t"],
+ 'testfile' => ["$FindBin::Bin/live_engine_request_headers.t"],
+ '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' );
+
+ my @parts = $request->parts;
+
+ for ( my $i = 0 ; $i < @parts ; $i++ ) {
+
+ my $part = $parts[$i];
+ my $disposition = $part->header('Content-Disposition');
+ my %parameters = @{ ( split_header_words($disposition) )[0] };
+
+ my $upload = $creq->{uploads}->{ $parameters{name} }->[$i];
+
+ isa_ok( $upload, 'Catalyst::Request::Upload' );
+ is( $upload->type, $part->content_type, 'Upload Content-Type' );
+ is( $upload->filename, $parameters{filename}, 'Upload filename' );
+ is( $upload->size, length( $part->content ), 'Upload Content-Length' );
+
+ ok( !-e $upload->tempname, 'Upload temp file was deleted' );
+ }
+}
+
+{
+ my $creq;
+
+ my $request = POST(
+ 'http://localhost/engine/request/uploads/slurp',
+ 'Content-Type' => 'multipart/form-data',
+ 'Content' =>
+ [ 'slurp' => ["$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' );
+ is( $response->content, ( $request->parts )[0]->content, 'Content' );
+}
+
+{
+ my $request = POST(
+ 'http://localhost/dump/request',
+ 'Content-Type' => 'multipart/form-data',
+ 'Content' =>
+ [ 'file' => ["$FindBin::Bin/catalyst_130pix.gif"], ]
+ );
+
+ # LWP will auto-correct Content-Length when using a remote server
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip 'Using remote server', 2;
+ }
+
+ # Sending wrong Content-Length here and see if subequent requests fail
+ $request->header('Content-Length' => $request->header('Content-Length') + 1);
+
+ ok( my $response = request($request), 'Request' );
+ ok( !$response->is_success, 'Response Error' );
+ }
+
+ $request = POST(
+ 'http://localhost/dump/request',
+ 'Content-Type' => 'multipart/form-data',
+ 'Content' =>
+ [ 'file1' => ["$FindBin::Bin/catalyst_130pix.gif"],
+ 'file2' => ["$FindBin::Bin/catalyst_130pix.gif"], ]
+ );
+
+ 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/file1 => bless/, 'Upload with name file1');
+ like( $response->content, qr/file2 => bless/, 'Upload with name file2');
+}
+
+{
+ my $creq;
+
+ my $request = POST(
+ 'http://localhost/dump/request/',
+ 'Content-Type' => 'form-data',
+ 'Content' => [
+ 'testfile' => 'textfield value',
+ 'testfile' => ["$FindBin::Bin/catalyst_130pix.gif"],
+ ]
+ );
+
+ 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' );
+
+ my $param = $creq->{parameters}->{testfile};
+
+ ok( @$param == 2, '2 values' );
+ is( $param->[0], 'textfield value', 'correct value' );
+ like( $param->[1], qr/\Qcatalyst_130pix.gif/, 'filename' );
+
+ 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' );
+ is( $upload->filename, 'catalyst_130pix.gif' );
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_uri.t (from rev 4483, trunk/Catalyst/t/live_engine_request_uri.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_uri.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_request_uri.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,121 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 49;
+use Catalyst::Test 'TestApp';
+use Catalyst::Request;
+
+my $creq;
+
+# test that the path can be changed
+{
+ ok( my $response = request('http://localhost/engine/request/uri/change_path'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ like( $creq->uri, qr{/my/app/lives/here$}, 'URI contains new path' );
+}
+
+# test that path properly removes the base location
+{
+ ok( my $response = request('http://localhost/engine/request/uri/change_base'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ like( $creq->base, qr{/new/location}, 'Base URI contains new location' );
+ is( $creq->path, 'engine/request/uri/change_base', 'URI contains correct path' );
+}
+
+# test that base + path is correct
+{
+ ok( my $response = request('http://localhost/engine/request/uri'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ is( $creq->base . $creq->path, $creq->uri, 'Base + Path ok' );
+}
+
+# test base is correct for HTTPS URLs
+SKIP:
+{
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip 'Using remote server', 5;
+ }
+
+ local $ENV{HTTPS} = 'on';
+ ok( my $response = request('https://localhost/engine/request/uri'), 'HTTPS Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ is( $creq->base, 'https://localhost/', 'HTTPS base ok' );
+ is( $creq->uri, 'https://localhost/engine/request/uri', 'HTTPS uri ok' );
+}
+
+# test that we can use semi-colons as separators
+{
+ my $parameters = {
+ a => [ qw/1 2/ ],
+ b => 3,
+ };
+
+ ok( my $response = request('http://localhost/engine/request/uri?a=1;a=2;b=3'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ is( $creq->{uri}->query, 'a=1;a=2;b=3', 'Query string ok' );
+ is_deeply( $creq->{parameters}, $parameters, 'Parameters ok' );
+}
+
+# test that query params are unescaped properly
+{
+ ok( my $response = request('http://localhost/engine/request/uri?text=Catalyst%20Rocks'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' );
+ is( $creq->{uri}->query, 'text=Catalyst%20Rocks', 'Query string ok' );
+ is( $creq->{parameters}->{text}, 'Catalyst Rocks', 'Unescaped param ok' );
+}
+
+# test that uri_with adds params
+{
+ ok( my $response = request('http://localhost/engine/request/uri/uri_with'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ ok( !defined $response->header( 'X-Catalyst-Param-a' ), 'param "a" ok' );
+ is( $response->header( 'X-Catalyst-Param-b' ), '1', 'param "b" ok' );
+}
+
+# test that uri_with adds params (and preserves)
+{
+ ok( my $response = request('http://localhost/engine/request/uri/uri_with?a=1'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-Param-a' ), '1', 'param "a" ok' );
+ is( $response->header( 'X-Catalyst-Param-b' ), '1', 'param "b" ok' );
+}
+
+# test that uri_with replaces params (and preserves)
+{
+ ok( my $response = request('http://localhost/engine/request/uri/uri_with?a=1&b=2'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-Param-a' ), '1', 'param "a" ok' );
+ is( $response->header( 'X-Catalyst-Param-b' ), '1', 'param "b" ok' );
+}
+
+# test that uri_with replaces params (and preserves)
+{
+ ok( my $response = request('http://localhost/engine/request/uri/uri_with_object'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ like( $response->header( 'X-Catalyst-Param-a' ), qr(https?://localhost[^/]*/), 'param "a" ok' );
+}
+
+# test that uri_with is utf8 safe
+{
+ ok( my $response = request("http://localhost/engine/request/uri/uri_with_utf8"), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ like( $response->header( 'X-Catalyst-uri-with' ), qr/%E2%98%A0$/, 'uri_with ok' );
+}
+
+# test with undef -- no warnings should be thrown
+{
+ ok( my $response = request("http://localhost/engine/request/uri/uri_with_undef"), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->header( 'X-Catalyst-warnings' ), 0, 'no warnings emitted' );
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_cookies.t (from rev 4483, trunk/Catalyst/t/live_engine_response_cookies.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_cookies.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_cookies.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,73 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 15;
+use Catalyst::Test 'TestApp';
+use HTTP::Headers::Util 'split_header_words';
+
+my $expected = {
+ Catalyst => [qw|Catalyst Cool path /bah|],
+ Cool => [qw|Cool Catalyst path /|]
+};
+
+{
+ ok( my $response = request('http://localhost/engine/response/cookies/one'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'engine/response/cookies/one', 'Test Action' );
+
+ my $cookies = {};
+
+ for my $string ( $response->header('Set-Cookie') ) {
+ my $cookie = [ split_header_words $string];
+ $cookies->{ $cookie->[0]->[0] } = $cookie->[0];
+ }
+
+ is_deeply( $cookies, $expected, 'Response Cookies' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/cookies/two'),
+ 'Request' );
+ ok( $response->is_redirect, 'Response Redirection 3xx' );
+ is( $response->code, 302, 'Response Code' );
+ is( $response->header('X-Catalyst-Action'),
+ 'engine/response/cookies/two', 'Test Action' );
+
+ my $cookies = {};
+
+ for my $string ( $response->header('Set-Cookie') ) {
+ my $cookie = [ split_header_words $string];
+ $cookies->{ $cookie->[0]->[0] } = $cookie->[0];
+ }
+
+ is_deeply( $cookies, $expected, 'Response Cookies' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/cookies/three'),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'engine/response/cookies/three', 'Test Action' );
+
+ my $cookies = {};
+
+ for my $string ( $response->header('Set-Cookie') ) {
+ my $cookie = [ split_header_words $string];
+ $cookies->{ $cookie->[0]->[0] } = $cookie->[0];
+ }
+
+ is_deeply( $cookies, {
+ hash => [ qw(hash a&b&c path /) ],
+ this_is_the_real_name => [ qw(this_is_the_real_name foo&bar path /) ], # not "object"
+ }, 'Response Cookies' );
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_errors.t (from rev 4483, trunk/Catalyst/t/live_engine_response_errors.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_errors.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_errors.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,60 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 18;
+use Catalyst::Test 'TestApp';
+
+close STDERR; # i'm naughty :)
+
+{
+ ok( my $response = request('http://localhost/engine/response/errors/one'),
+ 'Request' );
+ ok( $response->is_error, 'Response Server Error 5xx' );
+ is( $response->code, 500, 'Response Code' );
+ is( $response->content_type, 'text/html', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'engine/response/errors/one', 'Test Action' );
+ like(
+ $response->header('X-Catalyst-Error'),
+ qr/^Caught exception/,
+ 'Catalyst Error'
+ );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/errors/two'),
+ 'Request' );
+ ok( $response->is_error, 'Response Server Error 5xx' );
+ is( $response->code, 500, 'Response Code' );
+ is( $response->content_type, 'text/html', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'),
+ 'engine/response/errors/two', 'Test Action' );
+ like(
+ $response->header('X-Catalyst-Error'),
+ qr/^Couldn't forward to/,
+ 'Catalyst Error'
+ );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/errors/three'),
+ 'Request' );
+ ok( $response->is_error, 'Response Server Error 5xx' );
+ is( $response->code, 500, 'Response Code' );
+ is( $response->content_type, 'text/html', 'Response Content-Type' );
+ is(
+ $response->header('X-Catalyst-Action'),
+ 'engine/response/errors/three',
+ 'Test Action'
+ );
+ like(
+ $response->header('X-Catalyst-Error'),
+ qr/I'm going to die!/,
+ 'Catalyst Error'
+ );
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_headers.t (from rev 4483, trunk/Catalyst/t/live_engine_response_headers.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_headers.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_headers.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,58 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 18;
+use Catalyst::Test 'TestApp';
+use HTTP::Request::Common;
+
+my $content_length;
+
+foreach my $method qw(HEAD GET) {
+ my $expected = join( ', ', 1 .. 10 );
+
+ my $request = HTTP::Request::Common->can($method)
+ ->( 'http://localhost/engine/response/headers/one' );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->code, 200, 'Response Code' );
+ is( $response->header('X-Catalyst-Action'),
+ 'engine/response/headers/one', 'Test Action' );
+ is( $response->header('X-Header-Catalyst'),
+ 'Cool', 'Response Header X-Header-Catalyst' );
+ is( $response->header('X-Header-Cool'),
+ 'Catalyst', 'Response Header X-Header-Cool' );
+ is( $response->header('X-Header-Numbers'),
+ $expected, 'Response Header X-Header-Numbers' );
+
+ use bytes;
+ if ( $method eq 'HEAD' ) {
+ $content_length = $response->header('Content-Length');
+ ok( $content_length > 0, 'Response Header Content-Length' );
+ is( length($response->content),
+ 0,
+ 'HEAD method content is empty' );
+ }
+ elsif ( $method eq 'GET' ) {
+ # method name is echo'd back in content-body, which
+ # accounts for difference in content length. In normal
+ # cases the Content-Length should be the same regardless
+ # of if its a GET or HEAD request.
+ SKIP:
+ {
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip "Using remote server", 2;
+ }
+ is( $response->header('Content-Length'),
+ $content_length - 1, 'Response Header Content-Length' );
+ is( length($response->content),
+ $response->header('Content-Length'),
+ 'GET method content' );
+ }
+ }
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_large.t (from rev 4483, trunk/Catalyst/t/live_engine_response_large.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_large.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_large.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,27 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 6;
+use Catalyst::Test 'TestApp';
+
+# phaylon noticed that refactored was truncating output on large images.
+# This test tests 100K and 1M output content.
+
+my $expected = {
+ one => 'x' x (100 * 1024),
+ two => 'y' x (1024 * 1024),
+};
+
+for my $action ( keys %{$expected} ) {
+ ok( my $response = request('http://localhost/engine/response/large/' . $action ),
+ 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+
+ is( length( $response->content ), length( $expected->{$action} ), 'Length OK' );
+}
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_redirect.t (from rev 4483, trunk/Catalyst/t/live_engine_response_redirect.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_redirect.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_redirect.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,48 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 26;
+use Catalyst::Test 'TestApp';
+
+{
+ ok( my $response = request('http://localhost/engine/response/redirect/one'), 'Request' );
+ ok( $response->is_redirect, 'Response Redirection 3xx' );
+ is( $response->code, 302, 'Response Code' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/one', 'Test Action' );
+ is( $response->header('Location'), '/test/writing/is/boring', 'Response Header Location' );
+ ok( $response->header('Content-Length'), '302 Redirect contains Content-Length' );
+ ok( $response->content, '302 Redirect contains a response body' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/redirect/two'), 'Request' );
+ ok( $response->is_redirect, 'Response Redirection 3xx' );
+ is( $response->code, 302, 'Response Code' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/two', 'Test Action' );
+ is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/redirect/three'), 'Request' );
+ ok( $response->is_redirect, 'Response Redirection 3xx' );
+ is( $response->code, 301, 'Response Code' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/three', 'Test Action' );
+ is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
+ ok( $response->header('Content-Length'), '301 Redirect contains Content-Length' );
+ ok( $response->content, '301 Redirect contains a response body' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/redirect/four'), 'Request' );
+ ok( $response->is_redirect, 'Response Redirection 3xx' );
+ is( $response->code, 307, 'Response Code' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/redirect/four', 'Test Action' );
+ is( $response->header('Location'), 'http://www.google.com/', 'Response Header Location' );
+ ok( $response->header('Content-Length'), '307 Redirect contains Content-Length' );
+ ok( $response->content, '307 Redirect contains a response body' );
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_status.t (from rev 4483, trunk/Catalyst/t/live_engine_response_status.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_status.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_response_status.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,55 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 30;
+use Catalyst::Test 'TestApp';
+
+{
+ ok( my $response = request('http://localhost/engine/response/status/s200'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->code, 200, 'Response Code' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/status/s200', 'Test Action' );
+ like( $response->content, qr/^200/, 'Response Content' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/status/s400'), 'Request' );
+ ok( $response->is_error, 'Response Client Error 4xx' );
+ is( $response->code, 400, 'Response Code' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/status/s400', 'Test Action' );
+ like( $response->content, qr/^400/, 'Response Content' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/status/s403'), 'Request' );
+ ok( $response->is_error, 'Response Client Error 4xx' );
+ is( $response->code, 403, 'Response Code' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/status/s403', 'Test Action' );
+ like( $response->content, qr/^403/, 'Response Content' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/status/s404'), 'Request' );
+ ok( $response->is_error, 'Response Client Error 4xx' );
+ is( $response->code, 404, 'Response Code' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/status/s404', 'Test Action' );
+ like( $response->content, qr/^404/, 'Response Content' );
+}
+
+{
+ ok( my $response = request('http://localhost/engine/response/status/s500'), 'Request' );
+ ok( $response->is_error, 'Response Server Error 5xx' );
+ is( $response->code, 500, 'Response Code' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ is( $response->header('X-Catalyst-Action'), 'engine/response/status/s500', 'Test Action' );
+ like( $response->content, qr/^500/, 'Response Content' );
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_setup_basics.t (from rev 4483, trunk/Catalyst/t/live_engine_setup_basics.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_setup_basics.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_setup_basics.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,19 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 1;
+use Catalyst::Test 'TestApp';
+
+SKIP:
+{
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip "Using remote server", 1;
+ }
+ # Allow overriding automatic root.
+ is( TestApp->config->{root}, '/some/dir' );
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_setup_plugins.t (from rev 4483, trunk/Catalyst/t/live_engine_setup_plugins.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_setup_plugins.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_engine_setup_plugins.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,16 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 2;
+use Catalyst::Test 'TestApp';
+
+{
+ # Allow overriding automatic root.
+ ok( my $response = request('http://localhost/engine/response/headers/one'), 'Request' );
+ is( $response->header('X-Catalyst-Plugin-Setup'), '1' );
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_loop.t (from rev 4483, trunk/Catalyst/t/live_loop.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_loop.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_loop.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,23 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 3;
+use Catalyst::Test 'TestApp';
+
+SKIP:
+{
+ # Net::HTTP::Methods crashes when talking to a remote server because this
+ # test causes a very long header line to be sent
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip 'Using remote server', 3;
+ }
+
+ ok( my $response = request('http://localhost/loop_test'), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ ok( $response->header('X-Class-Forward-Test-Method'), 'Loop OK' );
+}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_plugin_loaded.t (from rev 4483, trunk/Catalyst/t/live_plugin_loaded.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_plugin_loaded.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_plugin_loaded.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,27 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 5;
+use Catalyst::Test 'TestApp';
+
+my @expected = qw[
+ Catalyst::Plugin::Test::Errors
+ Catalyst::Plugin::Test::Headers
+ Catalyst::Plugin::Test::Inline
+ Catalyst::Plugin::Test::Plugin
+ TestApp::Plugin::FullyQualified
+];
+
+my $expected = join( ", ", @expected );
+
+ok( my $response = request('http://localhost/dump/request'), 'Request' );
+ok( $response->is_success, 'Response Successful 2xx' );
+is( $response->content_type, 'text/plain', 'Response Content-Type' );
+like( $response->content, qr/'Catalyst::Request'/,
+ 'Content is a serialized Catalyst::Request' );
+is( $response->header('X-Catalyst-Plugins'), $expected, 'Loaded plugins' );
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_priorities.t (from rev 4483, trunk/Catalyst/t/live_priorities.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_priorities.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_priorities.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,81 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 28;
+use Catalyst::Test 'TestApp';
+use Data::Dumper;
+
+local $^W = 0;
+
+my $uri_base = 'http://localhost/priorities';
+my @tests = (
+
+ # Simple
+ 'Regex vs. Local', { path => '/re_vs_loc', expect => 'local' },
+ 'Regex vs. LocalRegex', { path => '/re_vs_locre', expect => 'regex' },
+ 'Regex vs. Path', { path => '/re_vs_path', expect => 'path' },
+ 'Local vs. LocalRegex', { path => '/loc_vs_locre', expect => 'local' },
+ 'Local vs. Path 1', { path => '/loc_vs_path1', expect => 'local' },
+ 'Local vs. Path 2', { path => '/loc_vs_path2', expect => 'path' },
+ 'Path vs. LocalRegex', { path => '/path_vs_locre', expect => 'path' },
+
+ # index
+ 'index vs. Regex', { path => '/re_vs_index', expect => 'index' },
+ 'index vs. Local', { path => '/loc_vs_index', expect => 'index' },
+ 'index vs. LocalRegex', { path => '/locre_vs_index', expect => 'index' },
+ 'index vs. Path', { path => '/path_vs_index', expect => 'index' },
+
+ 'multimethod zero', { path => '/multimethod', expect => 'zero' },
+ 'multimethod one', { path => '/multimethod/1', expect => 'one 1' },
+ 'multimethod two', { path => '/multimethod/1/2',
+ expect => 'two 1 2' },
+);
+
+while ( @tests ) {
+
+ my $name = shift @tests;
+ my $data = shift @tests;
+
+ # Run tests for path with trailing slash and without
+ SKIP: for my $req_uri
+ (
+ join( '' => $uri_base, $data->{ path } ), # Without trailing path
+ join( '' => $uri_base, $data->{ path }, '/' ), # With trailing path
+ ) {
+ my $end_slash = ( $req_uri =~ qr(/$) ? 1 : 0 );
+
+ # use slash_expect argument if URI ends with slash
+ # and the slash_expect argument is defined
+ my $expect = $data->{ expect } || '';
+ if ( $end_slash and exists $data->{ slash_expect } ) {
+ $expect = $data->{ slash_expect };
+ }
+
+ # Call the URI on the TestApp
+ my $response = request( $req_uri );
+
+ # Leave expect out to see the result
+ unless ( $expect ) {
+ skip 'Nothing expected, winner is ' . $response->content, 1;
+ }
+
+ # Show error if response was no success
+ if ( not $response->is_success ) {
+ diag 'Error: ' . $response->headers->{ 'x-catalyst-error' };
+ }
+
+ # Test if content matches expectations.
+ # TODO This might flood the screen with the catalyst please-come-later
+ # page. So I don't know it is a good idea.
+ is( $response->content, $expect,
+ "$name: @{[ $data->{ expect } ]} wins"
+ . ( $end_slash ? ' (trailing slash)' : '' )
+ );
+ }
+}
+
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_recursion.t (from rev 4483, trunk/Catalyst/t/live_recursion.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_recursion.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/live_recursion.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,25 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 3;
+use Catalyst::Test 'TestApp';
+
+local $^W = 0;
+
+SKIP:
+{
+ # Net::HTTP::Methods crashes when talking to a remote server because this
+ # test causes a very long header line to be sent
+ if ( $ENV{CATALYST_SERVER} ) {
+ skip 'Using remote server', 3;
+ }
+
+ ok( my $response = request('http://localhost/recursion_test'), 'Request' );
+ ok( !$response->is_success, 'Response Not Successful' );
+ is( $response->header('X-Catalyst-Error'), 'Deep recursion detected calling "/recursion_test"', 'Deep Recursion Detected' );
+}
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/optional_http-server-restart.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/optional_http-server-restart.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/optional_http-server-restart.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -45,10 +45,11 @@
my $port = 30000 + int rand( 1 + 10000 );
my( $server, $pid );
-$pid = open3( undef, $server, undef,
- $^X, "-I$FindBin::Bin/../lib",
+my @cmd = ($^X, "-I$FindBin::Bin/../lib", "-I$FindBin::Bin/lib",
"$FindBin::Bin/../t/tmp/TestApp/script/testapp_server.pl", '-port',
- $port, '-restart' )
+ $port, '-restart');
+
+$pid = open3( undef, $server, undef, @cmd )
or die "Unable to spawn standalone HTTP server: $!";
# switch to non-blocking reads so we can fail
@@ -67,11 +68,9 @@
"$FindBin::Bin/../t/tmp/TestApp/lib/TestApp.pm",
"$FindBin::Bin/../t/tmp/TestApp/lib/TestApp/Controller/Action/Begin.pm",
"$FindBin::Bin/../t/tmp/TestApp/lib/TestApp/Controller/Immutable.pm",
+ "$FindBin::Bin/../t/tmp/TestApp/lib/TestApp/Controller/Immutable/HardToReload.pm",
);
-push(@files, "$FindBin::Bin/../t/tmp/TestApp/lib/TestApp/Controller/Immutable/HardToReload.pm")
- if Catalyst::Engine::HTTP::Restarter::Watcher::DETECT_PACKAGE_COMPILATION();
-
# change some files and make sure the server restarts itself
NON_ERROR_RESTART:
for ( 1 .. 20 ) {
@@ -84,7 +83,6 @@
# give the server time to notice the change and restart
my $count = 0;
my $line;
-
while ( ( $line || '' ) !~ /can connect/ ) {
# wait for restart message
$line = $server->getline;
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/optional_http-server.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/optional_http-server.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/optional_http-server.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,16 +1,14 @@
+#!perl
+
use strict;
use warnings;
-use Test::More;
-BEGIN {
- plan skip_all => 'set TEST_HTTP to enable this test' unless $ENV{TEST_HTTP};
-}
-
use File::Path;
use FindBin;
-use IPC::Open3;
use IO::Socket;
+use Test::More;
+plan skip_all => 'set TEST_HTTP to enable this test' unless $ENV{TEST_HTTP};
eval "use Catalyst::Devel 1.0";
plan skip_all => 'Catalyst::Devel required' if $@;
eval "use File::Copy::Recursive";
@@ -20,15 +18,13 @@
# Run a single test by providing it as the first arg
my $single_test = shift;
-my $tmpdir = "$FindBin::Bin/../t/tmp";
-
# clean up
-rmtree $tmpdir if -d $tmpdir;
+rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp";
# create a TestApp and copy the test libs into it
-mkdir $tmpdir;
-chdir $tmpdir;
-system( $^X, "-I$FindBin::Bin/../lib", "$FindBin::Bin/../script/catalyst.pl", 'TestApp' );
+mkdir "$FindBin::Bin/../t/tmp";
+chdir "$FindBin::Bin/../t/tmp";
+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' );
@@ -37,9 +33,8 @@
# spawn the standalone HTTP server
my $port = 30000 + int rand(1 + 10000);
-my $pid = open3( undef, my $server, undef,
- $^X, "-I$FindBin::Bin/../lib",
- "$FindBin::Bin/../t/tmp/TestApp/script/testapp_server.pl", '-port', $port )
+my $pid = open my $server,
+ "perl -I$FindBin::Bin/../lib $FindBin::Bin/../t/tmp/TestApp/script/testapp_server.pl -port $port 2>&1 |"
or die "Unable to spawn standalone HTTP server: $!";
# wait for it to start
@@ -51,12 +46,11 @@
# run the testsuite against the HTTP server
$ENV{CATALYST_SERVER} = "http://localhost:$port";
-my $return;
if ( $single_test ) {
- $return = system( "$^X -Ilib/ $single_test" );
+ system( "perl -Ilib/ $single_test" );
}
else {
- $return = prove( '-r', '-Ilib/', glob('t/aggregate/live_*.t') );
+ system( 'prove -r -Ilib/ t/live_*' );
}
# shut it down
@@ -66,7 +60,7 @@
# clean up
rmtree "$FindBin::Bin/../t/tmp" if -d "$FindBin::Bin/../t/tmp";
-is( $return, 0, 'live tests' );
+ok( 'done' );
sub check_port {
my ( $host, $port ) = @_;
@@ -84,15 +78,3 @@
return 0;
}
}
-
-sub prove {
- if (!(my $pid = fork)) {
- require App::Prove;
- my $prove = App::Prove->new;
- $prove->process_args(@_);
- exit( $prove->run ? 0 : 1 );
- } else {
- waitpid $pid, 0;
- return $?;
- }
-}
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_controller_config.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_controller_config.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_controller_config.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -34,17 +34,17 @@
package controller_a;
use base 'base_controller';
-
+
__PACKAGE__->config( key_a => 'value_a' );
}
-
-
+
+
{
package controller_b;
use base 'base_controller';
- __PACKAGE__->config->{key_b} = 'value_b';
+ __PACKAGE__->config( key_b => 'value_b' );
}
## Okay, we expect that the base controller has a config with one key
@@ -55,26 +55,26 @@
## ----------------------------------------------------------------------------
## THE TESTS. Basically we first check to make sure that all the children of
## the base_controller properly inherit the {base_key => 'base_value'} info
-## and that each of the children also has its local config data and that none
+## and that each of the children also has it's local config data and that none
## of the classes have data that is unexpected.
## ----------------------------------------------------------------------------
# First round, does everything have what we expect to find? If these tests fail there is something
-# wrong with the way config is storing its information.
+# wrong with the way config is storing it's information.
ok( base_controller->config->{base_key} eq 'base_value', 'base_controller has expected config value for "base_key"') or
diag('"base_key" defined as "'.base_controller->config->{base_key}.'" and not "base_value" in config');
ok( controller_a->config->{base_key} eq 'base_value', 'controller_a has expected config value for "base_key"') or
diag('"base_key" defined as "'.controller_a->config->{base_key}.'" and not "base_value" in config');
-
+
ok( controller_a->config->{key_a} eq 'value_a', 'controller_a has expected config value for "key_a"') or
diag('"key_a" defined as "'.controller_a->config->{key_a}.'" and not "value_a" in config');
ok( controller_b->config->{base_key} eq 'base_value', 'controller_b has expected config value for "base_key"') or
diag('"base_key" defined as "'.controller_b->config->{base_key}.'" and not "base_value" in config');
-
+
ok( controller_b->config->{key_b} eq 'value_b', 'controller_b has expected config value for "key_b"') or
diag('"key_b" defined as "'.controller_b->config->{key_b}.'" and not "value_b" in config');
@@ -83,9 +83,9 @@
ok( scalar(keys %{base_controller->config}) == 1, 'base_controller has the expected number of config values') or
diag("base_controller should have 1 config value, but it has ".scalar(keys %{base_controller->config}));
-
+
ok( scalar(keys %{controller_a->config}) == 2, 'controller_a has the expected number of config values') or
diag("controller_a should have 2 config value, but it has ".scalar(keys %{base_controller->config}));
-
+
ok( scalar(keys %{controller_b->config}) == 2, 'controller_b has the expected number of config values') or
diag("controller_a should have 2 config value, but it has ".scalar(keys %{base_controller->config}));
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_controller_namespace.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_controller_namespace.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_controller_namespace.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,24 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More tests => 2;
-
-BEGIN {
- package MyApp::Controller::Foo;
-
- use base qw/Catalyst::Controller/;
-
- package MyApp::Controller::Root;
-
- use base qw/Catalyst::Controller/;
-
- __PACKAGE__->config(namespace => '');
-
- package Stub;
-
- sub config { {} };
-}
-
-is(MyApp::Controller::Foo->action_namespace('Stub'), 'foo');
-
-is(MyApp::Controller::Root->action_namespace('Stub'), '');
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_action_for.t (from rev 4483, trunk/Catalyst/t/unit_core_action_for.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_action_for.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_action_for.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,20 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More;
+
+plan tests => 3;
+
+use_ok('TestApp');
+
+is(TestApp->action_for('global_action')->code, TestApp->can('global_action'),
+ 'action_for on appclass ok');
+
+is(TestApp->controller('Args')->action_for('args')->code,
+ TestApp::Controller::Args->can('args'),
+ 'action_for on controller ok');
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_component.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_component.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_component.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,4 +1,4 @@
-use Test::More tests => 22;
+use Test::More tests => 7;
use strict;
use warnings;
@@ -12,9 +12,6 @@
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');
@@ -23,71 +20,9 @@
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');
-
-# 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 = sort qw( MyApp::C::Controller MyApp::M::Model );
- my @got = sort MyApp->comp( qr{::[MC]::} );
- is_deeply( \@got, \@expected, 'multiple results from 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 'once';
- *MyApp::M::Model::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args};
- }
-
- my $c = bless {}, 'MyApp';
-
- $c->component('MyApp::M::Model', qw/foo bar/);
- is_deeply($args, [qw/foo bar/], 'args passed to ACCEPT_CONTEXT ok');
-
- $c->component('M::Model', qw/foo2 bar2/);
- is_deeply($args, [qw/foo2 bar2/], 'args passed to ACCEPT_CONTEXT ok');
-
- $c->component('Mode', qw/foo3 bar3/);
- is_deeply($args, [qw/foo3 bar3/], 'args passed to ACCEPT_CONTEXT ok');
-}
-
+ # Is this desired behaviour?
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_component_layers.t (from rev 5068, trunk/Catalyst-Runtime/t/unit_core_component_layers.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_component_layers.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_component_layers.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,21 @@
+use Test::More tests => 5;
+use strict;
+use warnings;
+use lib 't/lib';
+
+# This tests that we actually load the physical
+# copy of Model::Foo::Bar, in the case that Model::Foo
+# defines the Model::Foo::Bar namespace in memory,
+# but does not load the corresponding file.
+
+use_ok 'TestApp';
+
+my $model_foo = TestApp->model('Foo');
+
+can_ok($model_foo, 'model_foo_method');
+can_ok($model_foo, 'bar');
+
+my $model_foo_bar = $model_foo->bar;
+
+can_ok($model_foo_bar, 'model_foo_bar_method_from_foo');
+can_ok($model_foo_bar, 'model_foo_bar_method_from_foo_bar');
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_component_loading.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_component_loading.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_component_loading.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -63,10 +63,9 @@
write_component_file(\@dir_list, $name_final, <<EOF);
package $fullname;
-use MRO::Compat;
use base '$compbase';
sub COMPONENT {
- my \$self = shift->next::method(\@_);
+ my \$self = shift->NEXT::COMPONENT(\@_);
no strict 'refs';
*{\__PACKAGE__ . "::whoami"} = sub { return \__PACKAGE__; };
\$self;
@@ -82,12 +81,8 @@
$component->{name});
}
-my $shut_up_deprecated_warnings = q{
- __PACKAGE__->log(Catalyst::Log->new('fatal'));
-};
+eval "package $appclass; use Catalyst; __PACKAGE__->setup";
-eval "package $appclass; use Catalyst; $shut_up_deprecated_warnings __PACKAGE__->setup";
-
can_ok( $appclass, 'components');
my $complist = $appclass->components;
@@ -145,7 +140,6 @@
eval qq(
package $appclass;
use Catalyst;
-$shut_up_deprecated_warnings
__PACKAGE__->config->{ setup_components } = {
search_extra => [ '::Extra' ],
except => [ "${appclass}::Controller::Foo" ]
@@ -171,7 +165,7 @@
use base 'Catalyst::Model';
sub COMPONENT {
- my \$self = shift->next::method(\@_);
+ my \$self = shift->NEXT::COMPONENT(\@_);
no strict 'refs';
*{\__PACKAGE__ . "::whoami"} = sub { return \__PACKAGE__; };
\$self;
@@ -190,7 +184,7 @@
use base 'Catalyst::Model';
no warnings 'redefine';
-sub COMPONENT { return shift->next::method(\@_); }
+sub COMPONENT { return shift->NEXT::COMPONENT(\@_); }
1;
EOF
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_log.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_log.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_log.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,72 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More tests => 23;
-
-my $LOG;
-
-BEGIN {
- chdir 't' if -d 't';
- use lib '../lib';
- $LOG = 'Catalyst::Log';
- use_ok $LOG or die;
-}
-my @MESSAGES;
-{
- no warnings 'redefine';
- *Catalyst::Log::_send_to_log = sub {
- my $self = shift;
- push @MESSAGES, @_;
- };
-}
-
-can_ok $LOG, 'new';
-ok my $log = $LOG->new, '... and creating a new log object should succeed';
-isa_ok $log, $LOG, '... and the object it returns';
-
-can_ok $log, 'is_info';
-ok $log->is_info, '... and the default behavior is to allow info messages';
-
-can_ok $log, 'info';
-ok $log->info('hello there!'),
- '... passing it an info message should succeed';
-
-can_ok $log, "_flush";
-$log->_flush;
-ok @MESSAGES, '... and flushing the log should succeed';
-is scalar @MESSAGES, 1, '... with one log message';
-like $MESSAGES[0], qr/^\[info\] hello there!$/,
- '... which should match the format we expect';
-
-{
-
- package Catalyst::Log::Subclass;
- use base qw/Catalyst::Log/;
-
- sub _send_to_log {
- my $self = shift;
- push @MESSAGES, '---';
- push @MESSAGES, @_;
- }
-}
-
-my $SUBCLASS = 'Catalyst::Log::Subclass';
-can_ok $SUBCLASS, 'new';
-ok $log = Catalyst::Log::Subclass->new,
- '... and the log subclass constructor shoudl return a new object';
-isa_ok $log, $SUBCLASS, '... and the object it returns';
-isa_ok $log, $LOG, '... and it also';
-
-can_ok $log, 'info';
-ok $log->info('hi there!'),
- '... passing it an info message should succeed';
-
-can_ok $log, "_flush";
- at MESSAGES = (); # clear the message log
-$log->_flush;
-ok @MESSAGES, '... and flushing the log should succeed';
-is scalar @MESSAGES, 2, '... with two log messages';
-is $MESSAGES[0], '---', '... with the first one being our new data';
-like $MESSAGES[1], qr/^\[info\] hi there!$/,
- '... which should match the format we expect';
-
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_merge_config_hashes.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_merge_config_hashes.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_merge_config_hashes.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,43 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-
-my @tests = (
- {
- given => [ { a => 1 }, { b => 1 } ],
- expects => { a => 1, b => 1 }
- },
- {
- given => [ { a => 1 }, { a => { b => 1 } } ],
- expects => { a => { b => 1 } }
- },
- {
- given => [ { a => { b => 1 } }, { a => 1 } ],
- expects => { a => 1 }
- },
- {
- given => [ { a => 1 }, { a => [ 1 ] } ],
- expects => { a => [ 1 ] }
- },
- {
- given => [ { a => [ 1 ] }, { a => 1 } ],
- expects => { a => 1 }
- },
- {
- given => [ { a => { b => 1 } }, { a => { b => 2 } } ],
- expects => { a => { b => 2 } }
- },
- {
- given => [ { a => { b => 1 } }, { a => { c => 1 } } ],
- expects => { a => { b => 1, c => 1 } }
- },
-);
-
-plan tests => scalar @tests + 1;
-
-use_ok('Catalyst');
-
-for my $test ( @ tests ) {
- is_deeply( Catalyst->merge_config_hashes( @{ $test->{ given } } ), $test->{ expects } );
-}
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_mvc.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_mvc.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_mvc.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,4 +1,4 @@
-use Test::More tests => 46;
+use Test::More tests => 27;
use strict;
use warnings;
@@ -8,6 +8,9 @@
map { "MyApp::$_"; }
qw/C::Controller M::Model V::View Controller::C Model::M View::V Controller::Model::Dummy::Model Model::Dummy::Model/;
+my $thingie={};
+bless $thingie,'MyApp::Model::Test::Object';
+push @complist,$thingie;
{
package MyApp;
@@ -15,13 +18,6 @@
use base qw/Catalyst/;
__PACKAGE__->components( { map { ( ref($_)||$_ , $_ ) } @complist } );
-
- my $thingie={};
- bless $thingie, 'Some::Test::Object';
- __PACKAGE__->components->{'MyApp::Model::Test::Object'} = $thingie;
-
- # allow $c->log->warn to work
- __PACKAGE__->setup_log;
}
is( MyApp->view('View'), 'MyApp::V::View', 'V::View ok' );
@@ -33,7 +29,7 @@
is( MyApp->model('Dummy::Model'), 'MyApp::Model::Dummy::Model', 'Model::Dummy::Model ok' );
-isa_ok( MyApp->model('Test::Object'), 'Some::Test::Object', 'Test::Object ok' );
+isa_ok( MyApp->model('Test::Object'), 'MyApp::Model::Test::Object', 'Test::Object ok' );
is( MyApp->controller('Model::Dummy::Model'), 'MyApp::Controller::Model::Dummy::Model', 'Controller::Model::Dummy::Model ok' );
@@ -43,11 +39,6 @@
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' );
@@ -60,15 +51,8 @@
[ qw/Dummy::Model M Model Test::Object/ ],
'models ok');
-{
- my $warnings = 0;
- no warnings 'redefine';
- local *Catalyst::Log::warn = sub { $warnings++ };
+is (MyApp->view , 'MyApp::V::View', 'view() with no defaults ok');
- 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';
@@ -77,20 +61,8 @@
is ( bless ({stash=>{current_view_instance=> $view, current_view=>'MyApp::V::View' }}, 'MyApp')->view , $view,
'current_view_instance precedes current_view ok');
-{
- my $warnings = 0;
- no warnings 'redefine';
- local *Catalyst::Log::warn = sub { $warnings++ };
+is (MyApp->model , 'MyApp::M::Model', 'model() with no defaults ok');
- ok( my $model = MyApp->model );
-
- ok( (($model =~ /^MyApp\::(M|Model)\::/) ||
- $model->isa('Some::Test::Object')),
- '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';
@@ -107,77 +79,14 @@
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 'once';
- *MyApp::Model::M::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args};
- *MyApp::View::V::ACCEPT_CONTEXT = sub { my ($self, $c, @args) = @_; $args= \@args};
- }
-
- my $c = bless {}, 'MyApp';
-
- # test accept-context with class rather than instance
- MyApp->model('M', qw/foo bar/);
- is_deeply($args, [qw/foo bar/], 'MyApp->model args passed to ACCEPT_CONTEXT ok');
-
-
- $c->model('M', qw/foo bar/);
- is_deeply($args, [qw/foo bar/], '$c->model args passed to ACCEPT_CONTEXT ok');
-
- my $x = $c->view('V', qw/foo2 bar2/);
- is_deeply($args, [qw/foo2 bar2/], '$c->view args passed to ACCEPT_CONTEXT ok');
-
- # regexp fallback
- $c->view('::View::V', qw/foo3 bar3/);
- is_deeply($args, [qw/foo3 bar3/], 'args passed to ACCEPT_CONTEXT ok');
-
-
-}
+ 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');
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_path_to.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_path_to.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_path_to.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,39 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-
-my %non_unix = (
- MacOS => 1,
- MSWin32 => 1,
- os2 => 1,
- VMS => 1,
- epoc => 1,
- NetWare => 1,
- dos => 1,
- cygwin => 1
-);
-
-my $os = $non_unix{$^O} ? $^O : 'Unix';
-
-if( $os ne 'Unix' ) {
- plan skip_all => 'tests require Unix';
-}
-else {
- plan tests => 3;
-}
-
-use_ok('Catalyst');
-
-my $context = 'Catalyst';
-
-my $config = Catalyst->config;
-
-$config->{home} = '/home/sri/my-app/';
-
-is( Catalyst::path_to( $context, 'foo' ), '/home/sri/my-app/foo', 'Unix path' );
-
-$config->{home} = '/Users/sri/myapp/';
-
-is( Catalyst::path_to( $context, 'foo', 'bar' ),
- '/Users/sri/myapp/foo/bar', 'deep Unix path' );
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_plugin.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_plugin.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_plugin.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 24;
+use Test::More tests => 22;
use lib 't/lib';
@@ -16,40 +16,17 @@
sub count { $count++ }
}
-my $warnings = 0;
-
-use PluginTestApp;
-my $logger = Class::MOP::Class->create_anon_class(
- methods => {
- warn => sub {
- if ($_[1] =~ /plugin method is deprecated/) {
- $warnings++;
- return;
- }
- die "Caught unexpected warning: " . $_[1];
- },
- },
-)->new_object;
-PluginTestApp->log($logger);
-
use Catalyst::Test qw/PluginTestApp/;
ok( get("/compile_time_plugins"), "get ok" );
-is( $warnings, 0, 'no warnings' );
-# FIXME - Run time plugin support is insane, and should be removed
-# for Catalyst 5.9
ok( get("/run_time_plugins"), "get ok" );
-is( $warnings, 1, '1 warning' );
-
use_ok 'TestApp';
my @expected = qw(
Catalyst::Plugin::Test::Errors
Catalyst::Plugin::Test::Headers
Catalyst::Plugin::Test::Inline
- Catalyst::Plugin::Test::MangleDollarUnderScore
Catalyst::Plugin::Test::Plugin
- TestApp::Plugin::AddDispatchTypes
TestApp::Plugin::FullyQualified
);
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_uri_for.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_uri_for.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_uri_for.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use Test::More tests => 20;
+use Test::More tests => 14;
use URI;
use_ok('Catalyst');
@@ -51,11 +51,6 @@
'http://127.0.0.1/foo/yada/bar/wibble%3F/with%20space', 'Space gets encoded'
);
-is(
- Catalyst::uri_for( $context, '/bar', 'with+plus', { 'also' => 'with+plus' })->as_string,
- 'http://127.0.0.1/foo/bar/with+plus?also=with%2Bplus',
- 'Plus is not encoded'
-);
# test with utf-8
is(
@@ -63,11 +58,6 @@
'http://127.0.0.1/foo/yada/quux?param1=%E2%98%A0',
'URI for undef action with query params in unicode'
);
-is(
- Catalyst::uri_for( $context, 'quux', { 'param:1' => "foo" } )->as_string,
- 'http://127.0.0.1/foo/yada/quux?param%3A1=foo',
- 'URI for undef action with query params in unicode'
-);
# test with object
is(
@@ -108,38 +98,3 @@
is( $warnings, 0, "no warnings emitted" );
}
-# Test with parameters '/', 'foo', 'bar' - should not generate a //
-is( Catalyst::uri_for( $context, qw| / foo bar | )->as_string,
- 'http://127.0.0.1/foo/bar', 'uri is /foo/bar, not //foo/bar'
-);
-
-TODO: {
- local $TODO = 'RFCs are for people who, erm - fix this test..';
- # Test rfc3986 reserved characters. These characters should all be escaped
- # according to the RFC, but it is a very big feature change so I've removed it
- no warnings; # Yes, everything in qw is sane
- is(
- Catalyst::uri_for( $context, qw|! * ' ( ) ; : @ & = $ / ? % # [ ] ,|, )->as_string,
- 'http://127.0.0.1/%21/%2A/%27/%2B/%29/%3B/%3A/%40/%26/%3D/%24/%2C/%2F/%3F/%25/%23/%5B/%5D',
- 'rfc 3986 reserved characters'
- );
-
- # jshirley bug - why the hell does only one of these get encoded
- # has been like this forever however.
- is(
- Catalyst::uri_for( $context, qw|{1} {2}| )->as_string,
- 'http://127.0.0.1/{1}/{2}',
- 'not-escaping unreserved characters'
- );
-}
-
-# make sure caller's query parameter hash isn't messed up
-{
- my $query_params_base = {test => "one two",
- bar => ["foo baz", "bar"]};
- my $query_params_test = {test => "one two",
- bar => ["foo baz", "bar"]};
- Catalyst::uri_for($context, '/bar/baz', $query_params_test);
- is_deeply($query_params_base, $query_params_test,
- "uri_for() doesn't mess up query parameter hash in the caller");
-}
Copied: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_uri_for_action.t (from rev 4483, trunk/Catalyst/t/unit_core_uri_for_action.t)
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_uri_for_action.t (rev 0)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_core_uri_for_action.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -0,0 +1,171 @@
+#!perl
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More;
+
+plan tests => 28;
+
+use_ok('TestApp');
+
+my $dispatcher = TestApp->dispatcher;
+
+#
+# Private Action
+#
+my $private_action = $dispatcher->get_action_by_path(
+ '/class_forward_test_method'
+ );
+
+ok(!defined($dispatcher->uri_for_action($private_action)),
+ "Private action returns undef for URI");
+
+#
+# Path Action
+#
+my $path_action = $dispatcher->get_action_by_path(
+ '/action/testrelative/relative'
+ );
+
+is($dispatcher->uri_for_action($path_action), "/action/relative/relative",
+ "Public path action returns correct URI");
+
+ok(!defined($dispatcher->uri_for_action($path_action, [ 'foo' ])),
+ "no URI returned for Path action when snippets are given");
+
+#
+# Regex Action
+#
+my $regex_action = $dispatcher->get_action_by_path(
+ '/action/regexp/one'
+ );
+
+ok(!defined($dispatcher->uri_for_action($regex_action)),
+ "Regex action without captures returns undef");
+
+ok(!defined($dispatcher->uri_for_action($regex_action, [ 1, 2, 3 ])),
+ "Regex action with too many captures returns undef");
+
+is($dispatcher->uri_for_action($regex_action, [ 'foo', 123 ]),
+ "/action/regexp/foo/123",
+ "Regex action interpolates captures correctly");
+
+#
+# Index Action
+#
+my $index_action = $dispatcher->get_action_by_path(
+ '/action/index/index'
+ );
+
+ok(!defined($dispatcher->uri_for_action($index_action, [ 'foo' ])),
+ "no URI returned for index action when snippets are given");
+
+is($dispatcher->uri_for_action($index_action),
+ "/action/index",
+ "index action returns correct path");
+
+#
+# Chained Action
+#
+my $chained_action = $dispatcher->get_action_by_path(
+ '/action/chained/endpoint',
+ );
+
+ok(!defined($dispatcher->uri_for_action($chained_action)),
+ "Chained action without captures returns undef");
+
+ok(!defined($dispatcher->uri_for_action($chained_action, [ 1, 2 ])),
+ "Chained action with too many captures returns undef");
+
+is($dispatcher->uri_for_action($chained_action, [ 1 ]),
+ "/chained/foo/1/end",
+ "Chained action with correct captures returns correct path");
+
+#
+# Tests with Context
+#
+my $request = Catalyst::Request->new( {
+ base => URI->new('http://127.0.0.1/foo')
+ } );
+
+my $context = TestApp->new( {
+ request => $request,
+ namespace => 'yada',
+ } );
+
+is($context->uri_for($path_action),
+ "http://127.0.0.1/foo/action/relative/relative",
+ "uri_for correct for path action");
+
+is($context->uri_for($path_action, qw/one two/, { q => 1 }),
+ "http://127.0.0.1/foo/action/relative/relative/one/two?q=1",
+ "uri_for correct for path action with args and query");
+
+ok(!defined($context->uri_for($path_action, [ 'blah' ])),
+ "no URI returned by uri_for for Path action with snippets");
+
+is($context->uri_for($regex_action, [ 'foo', 123 ], qw/bar baz/, { q => 1 }),
+ "http://127.0.0.1/foo/action/regexp/foo/123/bar/baz?q=1",
+ "uri_for correct for regex with captures, args and query");
+
+is($context->uri_for($chained_action, [ 1 ], 2, { q => 1 }),
+ "http://127.0.0.1/foo/chained/foo/1/end/2?q=1",
+ "uri_for correct for chained with captures, args and query");
+
+#
+# More Chained with Context Tests
+#
+{
+ sub __action { $dispatcher->get_action_by_path( @_ ) }
+
+ is( $context->uri_for( __action( '/action/chained/endpoint2' ), [1,2], (3,4), { x => 5 } ),
+ 'http://127.0.0.1/foo/chained/foo2/1/2/end2/3/4?x=5',
+ 'uri_for correct for chained with multiple captures and args' );
+
+ is( $context->uri_for( __action( '/action/chained/three_end' ), [1,2,3], (4,5,6) ),
+ 'http://127.0.0.1/foo/chained/one/1/two/2/3/three/4/5/6',
+ 'uri_for correct for chained with multiple capturing actions' );
+
+ my $action_needs_two = __action( '/action/chained/endpoint2' );
+
+ ok( ! defined( $context->uri_for($action_needs_two, [1], (2,3)) ),
+ 'uri_for returns undef for not enough captures' );
+
+ is( $context->uri_for($action_needs_two, [1,2], (2,3)),
+ 'http://127.0.0.1/foo/chained/foo2/1/2/end2/2/3',
+ 'uri_for returns correct uri for correct captures' );
+
+ ok( ! defined( $context->uri_for($action_needs_two, [1,2,3], (2,3)) ),
+ 'uri_for returns undef for too many captures' );
+
+ is( $context->uri_for($action_needs_two, [1,2], (3)),
+ 'http://127.0.0.1/foo/chained/foo2/1/2/end2/3',
+ 'uri_for returns uri with lesser args than specified on action' );
+
+ is( $context->uri_for($action_needs_two, [1,2], (3,4,5)),
+ 'http://127.0.0.1/foo/chained/foo2/1/2/end2/3/4/5',
+ 'uri_for returns uri with more args than specified on action' );
+
+ is( $context->uri_for($action_needs_two, [1,''], (3,4)),
+ 'http://127.0.0.1/foo/chained/foo2/1//end2/3/4',
+ 'uri_for returns uri with empty capture on undef capture' );
+
+ is( $context->uri_for($action_needs_two, [1,2], ('',3)),
+ 'http://127.0.0.1/foo/chained/foo2/1/2/end2//3',
+ 'uri_for returns uri with empty arg on undef argument' );
+
+ is( $context->uri_for($action_needs_two, [1,2], (3,'')),
+ 'http://127.0.0.1/foo/chained/foo2/1/2/end2/3/',
+ 'uri_for returns uri with empty arg on undef last argument' );
+
+ my $complex_chained = __action( '/action/chained/empty_chain_f' );
+ is( $context->uri_for( $complex_chained, [23], (13), {q => 3} ),
+ 'http://127.0.0.1/foo/chained/empty/23/13?q=3',
+ 'uri_for returns correct uri for chain with many empty path parts' );
+}
+
+
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_load_catalyst_test.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_load_catalyst_test.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_load_catalyst_test.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -3,152 +3,14 @@
use strict;
use warnings;
-use FindBin;
-use lib "$FindBin::Bin/lib";
-use Test::More tests => 59;
-use FindBin qw/$Bin/;
-use lib "$Bin/lib";
-use Catalyst::Utils;
-use HTTP::Request::Common;
-use Test::Exception;
+use Test::More;
-my $Class = 'Catalyst::Test';
-my $App = 'TestApp';
-my $Pkg = __PACKAGE__;
-my $Url = 'http://localhost/';
-my $Content = "root index";
+plan tests => 3;
-my %Meth = (
- $Pkg => [qw|get request ctx_request|], # exported
- $Class => [qw|local_request remote_request|], # not exported
-);
+use_ok('Catalyst::Test');
-### make sure we're not trying to connect to a remote host -- these are local tests
-local $ENV{CATALYST_SERVER};
+eval "get('http://localhost')";
+isnt( $@, "", "get returns an error message with no app specified");
-use_ok( $Class );
-
-### check available methods
-{ ### turn of redefine warnings, we'll get new subs exported
- ### XXX 'no warnings' and 'local $^W' wont work as warnings are turned on in
- ### test.pm, so trap them for now --kane
- { local $SIG{__WARN__} = sub {};
- ok( $Class->import, "Argumentless import for methods only" );
- }
-
- while( my($class, $meths) = each %Meth ) {
- for my $meth ( @$meths ) { SKIP: {
-
- ### method available?
- can_ok( $class, $meth );
-
- ### only for exported methods
- skip "Error tests only for exported methods", 2 unless $class eq $Pkg;
-
- ### check error conditions
- eval { $class->can($meth)->( $Url ) };
- ok( $@, " $meth without app gives error" );
- like( $@, qr/$Class/,
- " Error filled with expected content for '$meth'" );
- } }
- }
-}
-
-### simple tests for exported methods
-{ ### turn of redefine warnings, we'll get new subs exported
- ### XXX 'no warnings' and 'local $^W' wont work as warnings are turned on in
- ### test.pm, so trap them for now --kane
- { local $SIG{__WARN__} = sub {};
- ok( $Class->import( $App ),
- "Loading $Class for App $App" );
- }
-
- ### test exported methods again
- for my $meth ( @{ $Meth{$Pkg} } ) { SKIP: {
-
- ### do a call, we should get a result and perhaps a $c if it's 'ctx_request';
- my ($res, $c) = eval { $Pkg->can($meth)->( $Url ) };
-
- ok( 1, " Called $Pkg->$meth( $Url )" );
- ok( !$@, " No critical error $@" );
- ok( $res, " Result obtained" );
-
- ### get the content as a string, to make sure we got what we expected
- my $res_as_string = $meth eq 'get' ? $res : $res->content;
- is( $res_as_string, $Content,
- " Content as expected: $res_as_string" );
-
- ### some tests for 'ctx_request'
- skip "Context tests skipped for '$meth'", 6 unless $meth eq 'ctx_request';
-
- ok( $c, " Context object returned" );
- isa_ok( $c, $App, " Object" );
- is( $c->request->uri, $Url,
- " Url recorded in request" );
- is( $c->response->body, $Content,
- " Content recorded in response" );
- ok( $c->stash, " Stash accessible" );
- ok( $c->action, " Action object accessible" );
- } }
-}
-
-### perl5.8.8 + cat 5.80's Cat::Test->ctx_request didn't return $c the 2nd
-### time it was invoked. Without tracking the bug down all the way, it was
-### clearly related to the Moose'ification of Cat::Test and a scoping issue
-### with a 'my'd variable. Since the same code works fine in 5.10, a bug in
-### either Moose or perl 5.8 is suspected.
-{ ok( 1, "Testing consistency of ctx_request()" );
- for( 1..2 ) {
- my($res, $c) = ctx_request( $Url );
- ok( $c, " Call $_: Context object returned" );
- }
-}
-
-# FIXME - These vhosts in tests tests should be somewhere else...
-
-sub customize { Catalyst::Test::_customize_request(@_) }
-
-{
- my $req = Catalyst::Utils::request('/dummy');
- customize( $req );
- is( $req->header('Host'), undef, 'normal request is unmodified' );
-}
-
-{
- my $req = Catalyst::Utils::request('/dummy');
- customize( $req, { host => 'customized.com' } );
- like( $req->header('Host'), qr/customized.com/, 'request is customizable via opts hash' );
-}
-
-{
- my $req = Catalyst::Utils::request('/dummy');
- local $Catalyst::Test::default_host = 'localized.com';
- customize( $req );
- like( $req->header('Host'), qr/localized.com/, 'request is customizable via package var' );
-}
-
-{
- my $req = Catalyst::Utils::request('/dummy');
- local $Catalyst::Test::default_host = 'localized.com';
- customize( $req, { host => 'customized.com' } );
- like( $req->header('Host'), qr/customized.com/, 'opts hash takes precedence over package var' );
-}
-
-{
- my $req = Catalyst::Utils::request('/dummy');
- local $Catalyst::Test::default_host = 'localized.com';
- customize( $req, { host => '' } );
- is( $req->header('Host'), undef, 'default value can be temporarily cleared via opts hash' );
-}
-
-# Back compat test, extra args used to be ignored, now a hashref of options.
-use_ok('Catalyst::Test', 'TestApp', 'foobar');
-
-# Back compat test, ensure that request ignores anything which isn't a hash.
-lives_ok {
- request(GET('/dummy'), 'foo');
-} 'scalar additional param to request method ignored';
-lives_ok {
- request(GET('/dummy'), []);
-} 'array additional param to request method ignored';
-
+eval "request('http://localhost')";
+isnt( $@, "", "request returns an error message with no app specified");
Modified: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_stats.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_stats.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_stats.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 12;
+use Test::More tests => 13;
use Time::HiRes qw/gettimeofday/;
use Tree::Simple;
@@ -19,6 +19,8 @@
my $stats = Catalyst::Stats->new;
is (ref($stats), "Catalyst::Stats", "new");
+ is_deeply([ $stats->created ], [0, 0], "created time");
+
my @expected; # level, string, time
$fudge_t[0] = 1;
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_utils_env_value.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_utils_env_value.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_utils_env_value.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,44 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More tests => 5;
-
-BEGIN { use_ok("Catalyst::Utils") }
-
-##############################################################################
-### No env vars defined
-##############################################################################
-{
- ok( !Catalyst::Utils::env_value( 'MyApp', 'Key' ),
- 'No env values defined returns false'
- );
-}
-
-##############################################################################
-### App env var defined
-##############################################################################
-{
- $ENV{'MYAPP2_KEY'} = 'Env value 2';
- is( Catalyst::Utils::env_value( 'MyApp2', 'Key' ),
- 'Env value 2', 'Got the right value from the application var' );
-}
-
-##############################################################################
-### Catalyst env var defined
-##############################################################################
-{
- $ENV{'CATALYST_KEY'} = 'Env value 3';
- is( Catalyst::Utils::env_value( 'MyApp3', 'Key' ),
- 'Env value 3', 'Got the right value from the catalyst var' );
-}
-
-##############################################################################
-### Catalyst and Application env vars defined
-##############################################################################
-{
- $ENV{'CATALYST_KEY'} = 'Env value bad';
- $ENV{'MYAPP4_KEY'} = 'Env value 4';
- is( Catalyst::Utils::env_value( 'MyApp4', 'Key' ),
- 'Env value 4', 'Got the right value from the application var' );
-}
-
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_utils_prefix.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_utils_prefix.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_utils_prefix.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,26 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-use Test::More tests => 9;
-
-use lib "t/lib";
-
-BEGIN { use_ok("Catalyst::Utils") };
-
-is( Catalyst::Utils::class2prefix('MyApp::V::Foo::Bar'), 'foo/bar', 'class2prefix works with M/V/C' );
-
-is( Catalyst::Utils::class2prefix('MyApp::Controller::Foo::Bar'), 'foo/bar', 'class2prefix works with Model/View/Controller' );
-
-is( Catalyst::Utils::class2prefix('MyApp::Controller::Foo::View::Bar'), 'foo/view/bar', 'class2prefix works with tricky components' );
-
-is( Catalyst::Utils::appprefix('MyApp::Foo'), 'myapp_foo', 'appprefix works' );
-
-is( Catalyst::Utils::class2appclass('MyApp::Foo::Controller::Bar::View::Baz'), 'MyApp::Foo', 'class2appclass works' );
-
-is( Catalyst::Utils::class2classprefix('MyApp::Foo::Controller::Bar::View::Baz'), 'MyApp::Foo::Controller', 'class2classprefix works' );
-
-is( Catalyst::Utils::class2classsuffix('MyApp::Foo::Controller::Bar::View::Baz'), 'Controller::Bar::View::Baz', 'class2classsuffix works' );
-
-is( Catalyst::Utils::class2env('MyApp::Foo'), 'MYAPP_FOO', 'class2env works' );
Deleted: Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_utils_request.t
===================================================================
--- Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_utils_request.t 2009-11-24 14:28:38 UTC (rev 12002)
+++ Catalyst-Runtime/5.80/branches/contextual_uri_for/t/unit_utils_request.t 2009-11-24 17:19:15 UTC (rev 12003)
@@ -1,27 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More tests => 5;
-
-use_ok('Catalyst::Utils');
-
-{
- my $url = "/dump";
- ok(
- my $request = Catalyst::Utils::request($url),
- "Request: simple get without protocol nor host"
- );
- like( $request->uri, qr|^http://localhost/|,
- " has default protocol and host" );
-}
-
-{
- my $url = "/dump?url=http://www.somewhere.com/";
- ok(
- my $request = Catalyst::Utils::request($url),
- "Same with param containing a url"
- );
- like( $request->uri, qr|^http://localhost/|,
- " has default protocol and host" );
-}
-
More information about the Catalyst-commits
mailing list