Skip Menu |

This queue is for tickets about the CGI-Application-Dispatch CPAN distribution.

Report information
The Basics
Id: 22141
Status: resolved
Worked: 1 min
Priority: 0/
Queue: CGI-Application-Dispatch

People
Owner: Nobody in particular
Requestors: ZACKSE [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.03
Fixed in: (no value)



Subject: Documentation errors / typos (patch)
Attached is a patch that fixes some typos in the documentation. Two are coding/configuration errors (in the examples section) and the rest are spelling or other minor errors. Thanks for your work on this module, it has really helped simplify our setup as we don't need so many driver scripts anymore. Hope this helps, -E
Subject: cgiapp.dispatch.patch
diff -ur CGI-Application-Dispatch-2.03.orig/lib/CGI/Application/Dispatch.pm CGI-Application-Dispatch-2.03/lib/CGI/Application/Dispatch.pm --- CGI-Application-Dispatch-2.03.orig/lib/CGI/Application/Dispatch.pm 2006-09-29 22:07:00.000000000 -0400 +++ CGI-Application-Dispatch-2.03/lib/CGI/Application/Dispatch.pm 2006-10-17 03:33:51.181233704 -0400 @@ -153,7 +153,7 @@ =item default Specify a value to use in place of C<PATH_INFO> if C<PATH_INFO> is not provided. -This could be the case if the default page is selected (eg: "/" ). +This could be the case if the default page is selected (e.g., "/" ). =item prefix @@ -183,7 +183,7 @@ =item not_found -This is a URI to which the application will be redirected if the incoming request's +This is a URI to which the application will be redirected if the incoming request C<PATH_INFO> does not match anything in the L<DISPATCH TABLE>. This will also be used if there was a match, but the module could not be loaded, or the run mode did not exist. @@ -198,7 +198,7 @@ sub dispatch { my ($self, %args) = @_; - # merge dispatch_args() and %args with %args taking precendence + # merge dispatch_args() and %args with %args taking precedence my $dispatch_args = $self->dispatch_args(\%args); foreach my $arg (keys %$dispatch_args) { # args_to_new should be merged @@ -216,7 +216,7 @@ # combine any TMPL_PATHs if( $dispatch_args->{args_to_new}->{TMPL_PATH} ) { - # make sure the orginial is an array ref + # make sure the original is an array ref if( $args{args_to_new}->{TMPL_PATH} ) { if( ! ref $args{args_to_new}->{TMPL_PATH} ) { $args{args_to_new}->{TMPL_PATH} = [ @@ -254,7 +254,7 @@ $DEBUG = 1 if $args{debug}; - # Immediatey, try a cached result. + # Immediately, try a cached result. if ( my $final_args = $self->_url_cache() ) { # we can't use a cached Apache object $final_args->[2]{PARAMS}{r} = $args{args_to_new}{PARAMS}{r} @@ -281,7 +281,7 @@ carp "Passing extra args ('$_') to dispatch() is deprecated! Please use 'args_to_new'"; $args{args_to_new}->{$_} = delete $args{$_}; } - %args = map { lc $_ => $args{$_} } keys %args; # lc for backwards compatability + %args = map { lc $_ => $args{$_} } keys %args; # lc for backwards compatibility # get the PATH_INFO my $path_info = $ENV{PATH_INFO}; @@ -583,7 +583,7 @@ <Location /app> SetHandler perl-script PerlHandler CGI::Application::Dispatch - LerlSetVar CGIAPP_DISPATCH_PREFIX MyApp + PerlSetVar CGIAPP_DISPATCH_PREFIX MyApp PerlSetVar CGIAPP_DISPATCH_DEFAULT /module_name </Location> @@ -594,7 +594,7 @@ string). It also sets a default application module to be used if there is no C<PATH_INFO>. So, a url of C</app/module_name> would create an instance of C<MyApp::Module::Name>. -Using this method will add the C<Apache->request> object to your application's C<PARAMS> +Using this method will add the C<< Apache->request >> object to your application's C<PARAMS> as 'r'. # inside your app @@ -806,12 +806,12 @@ 'date/:year/:month?/:day?' => { app => 'Blog', rm => 'by_date', - args_to_new => { TMPL_PATH = "events/" }, + args_to_new => { TMPL_PATH => "events/" }, }, ] ); -So first, this call to L<dispatch> set's the L<prefix> and passes a C<TMPL_PATH> +So first, this call to L<dispatch> sets the L<prefix> and passes a C<TMPL_PATH> into L<args_to_new>. Next it sets the L<table>. @@ -819,7 +819,7 @@ Just so we all understand what we're talking about.... -A table is an array where the elements are gouped as pairs (similar to a hash's +A table is an array where the elements are grouped as pairs (similar to a hash's key-value pairs, but as an array to preserve order). The first element of each pair is called a C<rule>. The second element in the pair is called the rule's C<arg list>. Inside a rule there are backslashes C</>. Anything set of characters between backslashes @@ -853,7 +853,7 @@ 'posts/:category' C<:category> is a variable token. If the URL matched this rule, then you could retrieve -the value of that token from whithin your application like so: +the value of that token from within your application like so: my $category = $self->param('category'); @@ -915,7 +915,7 @@ =head2 Getting the module name -To get the name of the application module the C<PATH_INFO> is split on backslahes (C</>). +To get the name of the application module the C<PATH_INFO> is split on backslashes (C</>). The second element of the returned list is used to create the application module. So if we have a path info of @@ -925,8 +925,8 @@ method. Then if there is a C<prefix> (and there should always be a L<prefix>) it is added to the beginning of this new module name with a double colon C<::> separating the two. -If you don't like the exact way that this is done, don't fret you do have a couple of options. -First, you can specify a L<DISPATCH TABLE> which is much more powerfule and flexible (in fact +If you don't like the exact way that this is done, don't fret -- you do have a couple of options. +First, you can specify a L<DISPATCH TABLE> which is much more powerful and flexible (in fact this default behavior is actually implemented internally with a dispatch table). Or if you want something a little simpler, you can simply subclass and extend the L<translate_module_name> method. @@ -948,7 +948,7 @@ =item * CGI query strings CGI query strings are unaffected by the use of C<PATH_INFO> to obtain the module name and run mode. -This means that any other modules you use to get access to you query argument (ie, L<CGI>, +This means that any other modules you use to get access to your query argument (i.e., L<CGI>, L<Apache::Request>) should not be affected. But, since the run mode may be determined by CGI::Application::Dispatch having a query argument named 'rm' will be ignored by your application module. @@ -1012,7 +1012,7 @@ Here is a more complex example that dispatches "/", which would otherwise be treated as a directory, and also supports multiple developer directories, -so C</~mark> has its own seperate dispatching system beneath it. +so C</~mark> has its own separate dispatching system beneath it. Note that order matters here! The Location block for "/" needs to come before the user blocks. Only in CGI-Application-Dispatch-2.03/lib/CGI/Application: Dispatch.pm.bak
fixed in 2.04