Codebase list libcgi-application-dispatch-perl / upstream/3.07
Imported Upstream version 3.07 Nicholas Bamber 12 years ago
4 changed file(s) with 27 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
00 Revision history for Perl extension CGI::Application::Dispatch.
1
2 3.07 September 9th, 2011
3 Fix t/cgi.t test failures caused by Try::Tiny refactor in 3.05 (Yoshihiro Sasaki)
4
5 3.06 September 9th, 2011
6 Typo fix in "use" statement, introduced in 3.05 (Nicholas Bamber)
17
28 3.05 September 5th, 2011
39 Removed Exception::Class::TryCatch with the already required Try::Tiny thereby eliminating
4040 "provides" : {
4141 "CGI::Application::Dispatch" : {
4242 "file" : "lib/CGI/Application/Dispatch.pm",
43 "version" : "3.05"
43 "version" : "3.07"
4444 },
4545 "CGI::Application::Dispatch::PSGI" : {
4646 "file" : "lib/CGI/Application/Dispatch/PSGI.pm",
5757 "http://dev.perl.org/licenses/"
5858 ]
5959 },
60 "version" : "3.05"
60 "version" : "3.07"
6161 }
1818 provides:
1919 CGI::Application::Dispatch:
2020 file: lib/CGI/Application/Dispatch.pm
21 version: 3.05
21 version: 3.07
2222 CGI::Application::Dispatch::PSGI:
2323 file: lib/CGI/Application/Dispatch/PSGI.pm
2424 version: 3.04
3434 version: 0.82
3535 resources:
3636 license: http://dev.perl.org/licenses/
37 version: 3.05
37 version: 3.07
11 use strict;
22 use warnings;
33 use Carp qw(carp cluck);
4 use Try:Tiny;
5
6 our $VERSION = '3.05';
4 use Try::Tiny;
5
6 our $VERSION = '3.07';
77 our $DEBUG = 0;
88
99 BEGIN {
341341 $path_info = "/$path_info" unless(index($path_info, '/') == 0);
342342 $path_info = "$path_info/" unless(substr($path_info, -1) eq '/');
343343
344 my ($module, $rm, $local_prefix, $local_args_to_new);
344 my ($module, $rm, $local_prefix, $local_args_to_new, $output);
345345
346346 # take args from path
347347 my $named_args;
349349 $named_args = $self->_parse_path($path_info, $args{table})
350350 or throw_not_found("Resource not found");
351351 } catch {
352 $e = Exception::Class‐>caught();
353 return $self->http_error($e, $args{error_document});
352 $output = $self->http_error($_, $args{error_document});
354353 };
354 return $output if $output;
355355
356356 if($DEBUG) {
357357 require Data::Dumper;
358358 warn "[Dispatch] Named args from match: " . Data::Dumper::Dumper($named_args) . "\n";
359359 }
360360
361 if(exists($named_args->{PARAMS}) || exists($named_args->{TMPL_PATH})) {
362 carp "PARAMS and TMPL_PATH are not allowed here. Did you mean to use args_to_new?";
363 throw_error("PARAMS and TMPL_PATH not allowed");
364 }
365
366361 # eval and catch any exceptions that might be thrown
367 my ($output, @final_dispatch_args);
368362 try {
363 if(exists($named_args->{PARAMS}) || exists($named_args->{TMPL_PATH})) {
364 carp "PARAMS and TMPL_PATH are not allowed here. Did you mean to use args_to_new?";
365 throw_error("PARAMS and TMPL_PATH not allowed");
366 }
367
369368 ($module, $local_prefix, $rm, $local_args_to_new) =
370369 delete @{$named_args}{qw(app prefix rm args_to_new)};
371370
401400 }
402401
403402 # load and run the module
404 @final_dispatch_args = ($module, $rm, $local_args_to_new);
405403 $self->require_module($module);
406404 $output = $self->_run_app($module, $rm, $local_args_to_new);
407405 } catch {
408 $e = Exception::Class‐>caught();
409 return $self->http_error($e, $args{error_document});
406 my $e = $_;
407 unless ( ref $e ) {
408 local $@ = $e;
409 $e = Exception::Class->caught();
410 }
411 $output = $self->http_error($e, $args{error_document});
410412 };
411413 return $output;
412414 }