From: Mark Grimes Date: Wed, 27 Mar 2013 17:26:08 +0000 (-0400) Subject: Note DispatchType::Regex depreciation in docs and add warning if used. X-Git-Tag: 5.90030~5^2~6 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=f73d6ce28bc1c50abc27b50d52a965bdc002a748 Note DispatchType::Regex depreciation in docs and add warning if used. --- diff --git a/lib/Catalyst/Controller.pm b/lib/Catalyst/Controller.pm index 1594172..f1f6e75 100644 --- a/lib/Catalyst/Controller.pm +++ b/lib/Catalyst/Controller.pm @@ -649,7 +649,7 @@ overridden from the "namespace" config key. =head2 $self->path_prefix($c) -Returns the default path prefix for :PathPrefix, :Local, :LocalRegex and +Returns the default path prefix for :PathPrefix, :Local and relative :Path actions in this component. Defaults to the action_namespace or can be overridden from the "path" config key. @@ -751,7 +751,9 @@ This is a general toolbox for attaching your action to a give path. =head2 Regexp -Status: Deprecated. Use Chained methods or other techniques +Status: Deprecated. Use Chained methods or other techniques. +If you really depend on this, install the standalone +L distribution. A global way to match a give regular expression in the incoming request path. @@ -759,6 +761,10 @@ A global way to match a give regular expression in the incoming request path. =head2 LocalRegexp +Status: Deprecated. Use Chained methods or other techniques. +If you really depend on this, install the standalone +L distribution. + Like L but scoped under the namespace of the containing controller =head2 Chained diff --git a/lib/Catalyst/Dispatcher.pm b/lib/Catalyst/Dispatcher.pm index bb557ca..73d3f84 100644 --- a/lib/Catalyst/Dispatcher.pm +++ b/lib/Catalyst/Dispatcher.pm @@ -517,7 +517,14 @@ sub register { # 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 $@; + if( $@ ){ + warn( "Attempt to use deprecated $key dispatch type.\n" + . " Use Chained methods instead or install\n" + . " Catalyst::DispatchType::Regex if necessary.\n") + if $key =~ /^(Local)?Regex$/; + } else { + push( @{ $self->dispatch_types }, $class->new ); + } $registered->{$class} = 1; } }