X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst.pm;h=49c017598c99df14042a169b373e363208629ca9;hp=77aa8e9419a96b3492cb1a323ce939745ec3193f;hb=d59b65330ba88fe0b7314ffb7afc487a79f259ac;hpb=0ef52a963e678d3b8a40c72ff750f54ae2ba5ee6 diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 77aa8e9..49c0175 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -54,7 +54,7 @@ __PACKAGE__->engine_class('Catalyst::Engine::CGI'); __PACKAGE__->request_class('Catalyst::Request'); __PACKAGE__->response_class('Catalyst::Response'); -our $VERSION = '5.49_04'; +our $VERSION = '5.49_05'; sub import { my ( $class, @arguments ) = @_; @@ -116,10 +116,6 @@ Catalyst - The Elegant MVC Web Application Framework # called for /bar/of/soap, /bar/of/soap/10, etc. sub bar : Path('/bar/of/soap') { ... } - # called for / and only /, no other args - sub baz : Path { ... } - sub baz : Index { ... } - # called for all actions, from the top-most controller inwards sub auto : Private { my ( $self, $c ) = @_; @@ -142,8 +138,11 @@ Catalyst - The Elegant MVC Web Application Framework # called for /foo/bar sub bar : Local { ... } - # overrides /foo, but not /foo/1, etc. - sub index : Path { ... } + # called for /blargle + sub blargle : Global { ... } + + # an index action matches /foo, but not /foo/1, etc. + sub index : Private { ... } ### in MyApp/Controller/Foo/Bar.pm # called for /foo/bar/baz @@ -227,8 +226,6 @@ controller of the current action. Returns the current L object. - my $req = $c->req; - =back =head2 Processing and response to the current request @@ -300,8 +297,6 @@ sub error { Returns the current L object. - my $res = $c->res; - =item $c->stash Returns a hashref to the stash, which may be used to store data and pass it @@ -342,9 +337,8 @@ Contains the return value of the last executed action. =item $c->component($name) -Gets a component object by name. - - $c->comp('MyApp::Model::MyModel')->do_stuff; +Gets a component object by name. This method is no longer recommended. +$c->controller, $c->model, and $c->view should be used instead. =cut @@ -359,7 +353,8 @@ sub component { my @names = ( $name, "${appclass}::${name}", - map { "${appclass}::${_}::${name}" } qw/M V C/ + map { "${appclass}::${_}::${name}" } + qw/Model M Controller C View V/ ); foreach my $try (@names) { @@ -528,7 +523,7 @@ sub plugin { Initializes the dispatcher and engine, loads any plugins, and loads the model, view, and controller components. You may also specify an array of -plugins to load here, if you choose to not load them in the 'use Catalyst' +plugins to load here, if you choose to not load them in the C line. MyApp->setup; @@ -881,7 +876,7 @@ sub dispatch { my $c = shift; $c->dispatcher->dispatch( $c, @_ ) } Returns or sets the dispatcher class. -=item dump_these +=item $c->dump_these Returns a list of 2-element array references (name, structure) pairs that will be dumped on the error page in debug mode. @@ -1773,28 +1768,25 @@ sub version { return $Catalyst::VERSION } =head1 INTERNAL ACTIONS Catalyst uses internal actions like C<_DISPATCH>, C<_BEGIN>, C<_AUTO> -C<_ACTION> and C<_END>, these are by default not shown in the private -action table. - -But you can deactivate this with a config parameter. +C<_ACTION> and C<_END>. These are by default not shown in the private +action table, but you can make them visible with a config parameter. MyApp->config->{show_internal_actions} = 1; =head1 CASE SENSITIVITY -By default Catalyst is not case sensitive, so C becomes -C. - -But you can activate case sensitivity with a config parameter. +By default Catalyst is not case sensitive, so C is +mapped to C. You can activate case sensitivity with a config +parameter. MyApp->config->{case_sensitive} = 1; -So C becomes C. +This causes C to map to C. =head1 ON-DEMAND PARSER The request body is usually parsed at the beginning of a request, -but if you want to handle input yourself or speed things up a bit +but if you want to handle input yourself or speed things up a bit, you can enable on-demand parsing with a config parameter. MyApp->config->{parse_on_demand} = 1; @@ -1804,21 +1796,21 @@ you can enable on-demand parsing with a config parameter. Many production servers operate using the common double-server approach, with a lightweight frontend web server passing requests to a larger backend server. An application running on the backend server must deal with two -problems: the remote user always appears to be '127.0.0.1' and the server's -hostname will appear to be 'localhost' regardless of the virtual host the -user connected through. +problems: the remote user always appears to be C<127.0.0.1> and the server's +hostname will appear to be C regardless of the virtual host that +the user connected through. -Catalyst will automatically detect this situation when you are running both -the frontend and backend servers on the same machine. The following changes +Catalyst will automatically detect this situation when you are running the +frontend and backend servers on the same machine. The following changes are made to the request. $c->req->address is set to the user's real IP address, as read from the - HTTP_X_FORWARDED_FOR header. + HTTP X-Forwarded-For header. 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. + as read from the HTTP X-Forwarded-Host header. -Obviously, your web server must support these 2 headers for this to work. +Obviously, your web server must support these headers for this to work. In a more complex server farm environment where you may have your frontend proxy server(s) on different machines, you will need to set a configuration @@ -1833,12 +1825,12 @@ If you do not wish to use the proxy support at all, you may set: =head1 THREAD SAFETY Catalyst has been tested under Apache 2's threading mpm_worker, mpm_winnt, -and the standalone forking HTTP server on Windows. We believe the Catalyst +and the standalone forking HTTP server on Windows. We believe the Catalyst core to be thread-safe. If you plan to operate in a threaded environment, remember that all other -modules you are using must also be thread-safe. Some modules, most notably -DBD::SQLite, are not thread-safe. +modules you are using must also be thread-safe. Some modules, most notably +L, are not thread-safe. =head1 SUPPORT @@ -1846,7 +1838,7 @@ IRC: Join #catalyst on irc.perl.org. -Mailing-Lists: +Mailing Lists: http://lists.rawmode.org/mailman/listinfo/catalyst http://lists.rawmode.org/mailman/listinfo/catalyst-dev