Catalyst-DispatchType-Regex-5.90035000755000765000024 012506524042 17061 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/Build.PL000444000765000024 212112506524042 20506 0ustar00mgrimesstaff000000000000use strict; use warnings; use Module::Build; my $builder = Module::Build->new( module_name => 'Catalyst::DispatchType::Regex', license => 'perl', create_readme => 1, requires => { 'Catalyst::Runtime' => '5.90060', # ::Regex was removed as a prereq 'Moose' => '0', 'Text::Balanced' => '0', 'Text::SimpleTable' => '0' }, configure_requires => { 'Module::Build' => '0.4004' }, test_requires => { 'Test::More' => '0', 'Data::Dumper' => '0', 'MRO::Compat' => '0', 'Scalar::Util' => '0', 'Test::More' => '0', 'namespace::autoclean' => '0' }, recursive_test_files => 1, meta_merge => { resources => { bugtracker => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=Catalyst-DispatchType-Regex', repository => 'http://github.com/mvgrimes/catalyst-dispatch-regex' } }, add_to_cleanup => ['Catalyst-DispatchType-Regex-*'], ); $builder->create_build_script(); Catalyst-DispatchType-Regex-5.90035/Changes000444000765000024 505512506524042 20516 0ustar00mgrimesstaff000000000000Revision history for Catalyst-DispatchType-Regex 5.90035 - Tue Mar 31 09:57:18 EDT 2015 Updates the deprecation message to reflect the fact that this module has been dropped from Catalyst::Runtime. [No meaningful code changes. No need to upgrade.] 5.90034 - Tue Mar 31 09:47:32 EDT 2015 Adds Catalyst::Runtime to list of prereqs. - Catalyst::Runtime was not previously included as prereq as it caused circular dependencies. As of v5.90060, Catalyst::Runtime no longer includes this module as a prereq. Since that was released 14 months ago, it should be relatively safe to include Catalyst::Runtime as a prereq. Adds travis.ci integration. [No code changes. No need to upgrade.] 5.90033 - Tue Jun 18 14:20:48 EDT 2013 - Fixes spelling of deprecation. - Improves skips in tests. - Adds env flag to suppress the deprecation warning message. 5.90032 - Fri Apr 12 22:44:58 EDT 2013 Removes Catalyst-Runtime as a dependency While some cpan clients can handle circular dependencies, apparently not all of them can. Of course, it is hard to imagine anyone installing this without already having Catalyst installed, so dropping the Catalyst requirement is unlikely to cause any real problems other than limiting the automated testing. 5.90031 - Fri Apr 12 18:49:56 EDT 2013 Makes tests conditional on having Catalyst::Runtime 5.90030 installed To ease the depreciation process Catalyst::Runtime is including Catalyst::DispatchType::Regex as a requirement for a period of time. This causes a circular dependency. The installers seem to be smart enough to deal with the circular dependency, but the CDR tests fail because Catalyst::Runtime 5.90030 isn't installed. The test will be re-enabled once the requirement has been removed from Catalyst::Runtime. 5.90030 - Wed Apr 10 10:04:59 EDT 2013 Initial release of standalone Catalyst-DispatchType-Regex The Regex dispatch types have been depreciated and removed from Catalyst core. This distribution is being made available as a fallback for developers who need the Regex dispatch type until they can convert to Chaind methods or other alternative. This distribution creates a separate DispatchType for each of Regex, Regexp, LocalRegex, and LocalRegexp. Previously C::Dispatcher converted all of these to Regex before passing it off to that one dispatch type. Dispatch order is no longer guaranteed to be Regex before LocalRegex. It now depends on when the DispatchType is seen in a controller. Catalyst-DispatchType-Regex-5.90035/MANIFEST000444000765000024 167312506524042 20356 0ustar00mgrimesstaff000000000000Build.PL Changes lib/Catalyst/DispatchType/LocalRegex.pm lib/Catalyst/DispatchType/LocalRegexp.pm lib/Catalyst/DispatchType/Regex.pm lib/Catalyst/DispatchType/Regexp.pm MANIFEST This list of files t/01use.t t/aggregate/live_component_controller_action_regexp.t t/aggregate/live_priorities.t t/aggregate/unit_core_uri_for_action.t t/lib/Catalyst/Plugin/Test/Headers.pm t/lib/TestApp.pm t/lib/TestApp/Controller/Action.pm t/lib/TestApp/Controller/Action/Regexp.pm t/lib/TestApp/Controller/Priorities.pm t/lib/TestApp/Controller/Priorities/locre_vs_index.pm t/lib/TestApp/Controller/Priorities/re_vs_index.pm t/lib/TestApp/View/Dump.pm t/lib/TestApp/View/Dump/Action.pm t/lib/TestApp/View/Dump/Body.pm t/lib/TestApp/View/Dump/Env.pm t/lib/TestApp/View/Dump/Request.pm t/lib/TestApp/View/Dump/Response.pm xt/critic.t xt/fixme.t xt/hasversion.t xt/manifest.t xt/meta.t xt/minimumversion.t xt/perlcriticrc xt/pod-coverage.t xt/pod.t README META.yml META.json Catalyst-DispatchType-Regex-5.90035/META.json000444000765000024 336212506524042 20643 0ustar00mgrimesstaff000000000000{ "abstract" : "Regex DispatchType", "author" : [ "unknown" ], "dynamic_config" : 1, "generated_by" : "Module::Build version 0.4004, CPAN::Meta::Converter version 2.130880", "license" : [ "perl_5" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Catalyst-DispatchType-Regex", "prereqs" : { "configure" : { "requires" : { "Module::Build" : "0.4004" } }, "runtime" : { "requires" : { "Catalyst::Runtime" : "5.90060", "Moose" : "0", "Text::Balanced" : "0", "Text::SimpleTable" : "0" } } }, "provides" : { "Catalyst::DispatchType::LocalRegex" : { "file" : "lib/Catalyst/DispatchType/LocalRegex.pm" }, "Catalyst::DispatchType::LocalRegexp" : { "file" : "lib/Catalyst/DispatchType/LocalRegexp.pm" }, "Catalyst::DispatchType::Regex" : { "file" : "lib/Catalyst/DispatchType/Regex.pm", "version" : "5.90035" }, "Catalyst::DispatchType::Regexp" : { "file" : "lib/Catalyst/DispatchType/Regexp.pm" } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "http://rt.cpan.org/NoAuth/Bugs.html?Dist=Catalyst-DispatchType-Regex" }, "license" : [ "http://dev.perl.org/licenses/" ], "repository" : { "url" : "http://github.com/mvgrimes/catalyst-dispatch-regex" } }, "version" : "5.90035", "x_test_requires" : { "Data::Dumper" : "0", "MRO::Compat" : "0", "Scalar::Util" : "0", "Test::More" : "0", "namespace::autoclean" : "0" } } Catalyst-DispatchType-Regex-5.90035/META.yml000444000765000024 217312506524042 20472 0ustar00mgrimesstaff000000000000--- abstract: 'Regex DispatchType' author: - unknown build_requires: {} configure_requires: Module::Build: 0.4004 dynamic_config: 1 generated_by: 'Module::Build version 0.4004, CPAN::Meta::Converter version 2.130880' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Catalyst-DispatchType-Regex provides: Catalyst::DispatchType::LocalRegex: file: lib/Catalyst/DispatchType/LocalRegex.pm Catalyst::DispatchType::LocalRegexp: file: lib/Catalyst/DispatchType/LocalRegexp.pm Catalyst::DispatchType::Regex: file: lib/Catalyst/DispatchType/Regex.pm version: 5.90035 Catalyst::DispatchType::Regexp: file: lib/Catalyst/DispatchType/Regexp.pm requires: Catalyst::Runtime: 5.90060 Moose: 0 Text::Balanced: 0 Text::SimpleTable: 0 resources: bugtracker: http://rt.cpan.org/NoAuth/Bugs.html?Dist=Catalyst-DispatchType-Regex license: http://dev.perl.org/licenses/ repository: http://github.com/mvgrimes/catalyst-dispatch-regex version: 5.90035 x_test_requires: Data::Dumper: 0 MRO::Compat: 0 Scalar::Util: 0 Test::More: 0 namespace::autoclean: 0 Catalyst-DispatchType-Regex-5.90035/README000444000765000024 416312506524042 20102 0ustar00mgrimesstaff000000000000NAME Catalyst::DispatchType::Regex - Regex DispatchType SYNOPSIS See Catalyst::DispatchType. DESCRIPTION Status: Deprecated. Regex dispatch types have been deprecated and removed from Catalyst core. It is recommend that you use Chained methods or other techniques instead. As part of the refactoring, the dispatch priority of Regex vs Regexp vs LocalRegex vs LocalRegexp may have changed. Priority is now influenced by when the dispatch type is first seen in your application. When loaded, a warning about the deprecation will be printed to STDERR. To suppress the warning set the CATALYST_NOWARN_DEPRECATE environment variable to a true value. Dispatch type managing path-matching behaviour using regexes. For more information on dispatch types, see: * Catalyst::Manual::Intro for how they affect application authors * Catalyst::DispatchType for implementation information. METHODS $self->list($c) Output a table of all regex actions, and their private equivalent. $self->match( $c, $path ) Checks path against every compiled regex, and offers the action for any regex which matches a chance to match the request. If it succeeds, sets action, match and captures on $c->req and returns 1. If not, returns 0 without altering $c. $self->register( $c, $action ) Registers one or more regex actions for an action object. Also registers them as literal paths. Returns 1 if any regexps were registered. $self->register_regex($c, $re, $action) Register an individual regex on the action. Usually called from the register method. $self->uri_for_action($action, $captures) returns a URI for this action if it can find a regex attributes that contains the correct number of () captures. Note that this may function incorrectly in the case of nested captures - if your regex does (...(..))..(..) you'll need to pass the first and third captures only. AUTHORS Catalyst Contributors, see Catalyst.pm COPYRIGHT This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself. Catalyst-DispatchType-Regex-5.90035/lib000755000765000024 012506524042 17627 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/lib/Catalyst000755000765000024 012506524042 21413 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/lib/Catalyst/DispatchType000755000765000024 012506524042 24014 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/lib/Catalyst/DispatchType/LocalRegex.pm000444000765000024 346012506524042 26537 0ustar00mgrimesstaff000000000000package Catalyst::DispatchType::LocalRegex; use Moose; extends 'Catalyst::DispatchType::Regex'; has '+_attr' => ( default => 'LocalRegex' ); =head1 NAME Catalyst::DispatchType::LocalRegex - LocalRegex DispatchType =head1 SYNOPSIS See L. =head1 DESCRIPTION B Regex dispatch types have been deprecated and removed from Catalyst core. It is recommend that you use Chained methods or other techniques instead. As part of the refactoring, the dispatch priority of Regex vs Regexp vs LocalRegex vs LocalRegexp may have changed. Priority is now influenced by when the dispatch type is first seen in your application. When loaded, a warning about the deprecation will be printed to STDERR. To suppress the warning set the CATALYST_NOWARN_DEPRECATE environment variable to a true value. Dispatch type managing path-matching behaviour using regexes. For more information on dispatch types, see: =over 4 =item * L for how they affect application authors =item * L for implementation information. =back =cut around '_get_attributes' => sub { my ( $orig, $self, $c, $action ) = splice( @_, 0, 4 ); my @attributes = $self->$orig( $c, $action, @_ ); return map { $self->_parse_LocalRegex_attr( $c, $action, $_ ) } @attributes; }; sub _parse_LocalRegex_attr { my ( $self, $c, $action, $value ) = @_; unless ( $value =~ s/^\^// ) { $value = "(?:.*?)$value"; } my $prefix = $action->namespace(); $prefix .= '/' if length( $prefix ); return "^${prefix}${value}"; } no 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 __PACKAGE__->meta->make_immutable; 1; Catalyst-DispatchType-Regex-5.90035/lib/Catalyst/DispatchType/LocalRegexp.pm000444000765000024 270112506524042 26714 0ustar00mgrimesstaff000000000000package Catalyst::DispatchType::LocalRegexp; use Moose; extends 'Catalyst::DispatchType::LocalRegex'; has '+_attr' => ( default => 'LocalRegexp' ); no Moose; =head1 NAME Catalyst::DispatchType::LocalRegexp - LocalRegexp DispatchType =head1 SYNOPSIS See L. =head1 DESCRIPTION B Regex dispatch types have been deprecated and removed from Catalyst core. It is recommend that you use Chained methods or other techniques instead. As part of the refactoring, the dispatch priority of Regex vs Regexp vs LocalRegex vs LocalRegexp may have changed. Priority is now influenced by when the dispatch type is first seen in your application. When loaded, a warning about the deprecation will be printed to STDERR. To suppress the warning set the CATALYST_NOWARN_DEPRECATE environment variable to a true value. Dispatch type managing path-matching behaviour using regexes. This simply supports the alternate spelling of C. All the work is done in L. For more information on dispatch types, see: =over 4 =item * L for how they affect application authors =item * L for implementation information. =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 __PACKAGE__->meta->make_immutable; 1; Catalyst-DispatchType-Regex-5.90035/lib/Catalyst/DispatchType/Regex.pm000444000765000024 1415212506524042 25604 0ustar00mgrimesstaff000000000000package Catalyst::DispatchType::Regex; use Moose; extends 'Catalyst::DispatchType::Path'; use Text::SimpleTable; use Catalyst::Utils; use Text::Balanced (); has _compiled => ( is => 'rw', isa => 'ArrayRef', required => 1, default => sub{ [] }, ); has _attr => ( is => 'ro', isa => 'Str', required => 1, default => 'Regex', ); no Moose; # Version needs to be in a format such that $VERSION gt '5.90020' => true # We use in Catalyst::Dispatcher ($VERSION le '5.90020') our $VERSION = '5.90035'; =head1 NAME Catalyst::DispatchType::Regex - Regex DispatchType =for html Build Status =head1 SYNOPSIS See L. =head1 DESCRIPTION B Regex dispatch types have been deprecated and removed from Catalyst core. It is recommend that you use Chained methods or other techniques instead. As part of the refactoring, the dispatch priority of Regex vs Regexp vs LocalRegex vs LocalRegexp may have changed. Priority is now influenced by when the dispatch type is first seen in your application. When loaded, a warning about the deprecation will be printed to STDERR. To suppress the warning set the CATALYST_NOWARN_DEPRECATE environment variable to a true value. Dispatch type managing path-matching behaviour using regexes. For more information on dispatch types, see: =over 4 =item * L for how they affect application authors =item * L for implementation information. =back =head1 METHODS =head2 $self->list($c) Output a table of all regex actions, and their private equivalent. =cut sub list { my ( $self, $c ) = @_; 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, $self->_attr ], [ $col2_width, 'Private' ] ); for my $regex ( @{ $self->_compiled } ) { my $action = $regex->{action}; $re->row( $regex->{path}, "/$action" ); } $c->log->debug( "Loaded Regex actions:\n" . $re->draw . "\n" ) if ( @{ $self->_compiled } ); } =head2 $self->match( $c, $path ) Checks path against every compiled regex, and offers the action for any regex which matches a chance to match the request. If it succeeds, sets action, match and captures on $c->req and returns 1. If not, returns 0 without altering $c. =cut sub match { my ( $self, $c, $path ) = @_; # Check path against plain text first return if $self->SUPER::match( $c, $path ); foreach my $compiled ( @{ $self->_compiled } ) { if ( my @captures = ( $path =~ $compiled->{re} ) ) { next unless $compiled->{action}->match($c); $c->req->action( $compiled->{path} ); $c->req->match($path); $c->req->captures( \@captures ); $c->action( $compiled->{action} ); $c->namespace( $compiled->{action}->namespace ); return 1; } } return 0; } =head2 $self->register( $c, $action ) Registers one or more regex actions for an action object. Also registers them as literal paths. Returns 1 if any regexps were registered. =cut sub register { my ( $self, $c, $action ) = @_; $self->_display_deprecation_warning; my @register = $self->_get_attributes( $c, $action ); foreach my $r (@register) { $self->register_path( $c, $r, $action ); $self->register_regex( $c, $r, $action ); } return 1 if @register; return 0; } sub _get_attributes { my ($self, $c, $action) = @_; my $attrs = $action->attributes; my $attr = $self->_attr; return @{ $attrs->{$attr} || [] }; } =head2 $self->register_regex($c, $re, $action) Register an individual regex on the action. Usually called from the register method. =cut sub register_regex { my ( $self, $c, $re, $action ) = @_; push( @{ $self->_compiled }, # and compiled regex for us { re => qr#$re#, action => $action, path => $re, } ); } =head2 $self->uri_for_action($action, $captures) returns a URI for this action if it can find a regex attributes that contains the correct number of () captures. Note that this may function incorrectly in the case of nested captures - if your regex does (...(..))..(..) you'll need to pass the first and third captures only. =cut sub uri_for_action { my ( $self, $action, $captures ) = @_; my $attr = $self->_attr; if (my $regexes = $action->attributes->{$attr}) { REGEX: foreach my $orig (@$regexes) { my $re = "$orig"; $re =~ s/^\^//; $re =~ s/\$$//; $re =~ s/\\([^\\])/$1/g; my $final = '/'; my @captures = @$captures; while (my ($front, $rest) = split(/\(/, $re, 2)) { last unless defined $rest; ($rest, $re) = Text::Balanced::extract_bracketed("(${rest}", '('); next REGEX unless @captures; $final .= $front.shift(@captures); } $final .= $re; next REGEX if @captures; return $final; } } return undef; } { my $deprecation_warning_displayed = 0; sub _display_deprecation_warning { return if $deprecation_warning_displayed++; return if $ENV{CATALYST_NOWARN_DEPRECATE}; warn "DEPRECATION WARNING: The Regex dispatch type is deprecated.\n" . " It is recommended that you convert Regex and LocalRegex \n" . " methods to Chained methods."; } } =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 __PACKAGE__->meta->make_immutable; 1; Catalyst-DispatchType-Regex-5.90035/lib/Catalyst/DispatchType/Regexp.pm000444000765000024 264412506524042 25747 0ustar00mgrimesstaff000000000000package Catalyst::DispatchType::Regexp; use Moose; extends 'Catalyst::DispatchType::Regex'; has '+_attr' => ( default => 'Regexp' ); no Moose; =head1 NAME Catalyst::DispatchType::Regexp - Regex DispatchType =head1 SYNOPSIS See L. =head1 DESCRIPTION B Regex dispatch types have been deprecated and removed from Catalyst core. It is recommend that you use Chained methods or other techniques instead. As part of the refactoring, the dispatch priority of Regex vs Regexp vs LocalRegex vs LocalRegexp may have changed. Priority is now influenced by when the dispatch type is first seen in your application. When loaded, a warning about the deprecation will be printed to STDERR. To suppress the warning set the CATALYST_NOWARN_DEPRECATE environment variable to a true value. Dispatch type managing path-matching behaviour using regexes. This simply supports the alternate spelling of C. All the work is done in L. For more information on dispatch types, see: =over 4 =item * L for how they affect application authors =item * L for implementation information. =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 __PACKAGE__->meta->make_immutable; 1; Catalyst-DispatchType-Regex-5.90035/t000755000765000024 012506524042 17324 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/t/01use.t000444000765000024 113412506524042 20602 0ustar00mgrimesstaff000000000000use Test::More; # This kludge is necessary to avoid failing due to circular dependencies # with Catalyst-Runtime. Not ideal, but until we remove CDR from # Catalyst-Runtime prereqs, this is necessary to avoid Catalyst-Runtime build # failing. BEGIN { plan skip_all => 'Catalyst::Runtime required' unless eval { require Catalyst }; plan skip_all => 'Test requires Catalyst::Runtime >= 5.90030' unless $Catalyst::VERSION >= 5.90030; plan tests => 1; } use_ok( 'Catalyst::DispatchType::Regex' ); diag( "Testing Catalyst::DispatchType::Regex $Catalyst::DispatchType::Regex::VERSION" ); Catalyst-DispatchType-Regex-5.90035/t/aggregate000755000765000024 012506524042 21252 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/t/aggregate/live_component_controller_action_regexp.t000444000765000024 1406412506524042 32014 0ustar00mgrimesstaff000000000000#!perl use strict; use warnings; use FindBin; use lib "$FindBin::Bin/../lib"; our $iters; BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; } use Test::More; # This kludge is necessary to avoid failing due to circular dependencies # with Catalyst-Runtime. Not ideal, but until we remove CDR from # Catalyst-Runtime prereqs, this is necessary to avoid Catalyst-Runtime build # failing. BEGIN { plan skip_all => 'Catalyst::Runtime required' unless eval { require Catalyst }; plan skip_all => 'Test requires Catalyst::Runtime >= 5.90030' unless $Catalyst::VERSION >= 5.90030; plan tests => 39*$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 { { # Test a Path action to make sure the setup is working ok( my $response = request('http://localhost/action/regexp/zero'), 'Request Path' ); ok( $response->is_success, '... Response Successful 2xx' ); is( $response->content_type, 'text/plain', '... Response Content-Type' ); is( $response->header('X-Catalyst-Action'), 'action/regexp/zero', '... 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' ); } { # Test LocalRegex() ok( my $response = request('http://localhost/action/regexp/10/hello'), 'Request LocalRegex()' ); 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' ); } { # Test Regex() ok( my $response = request('http://localhost/action/regexp/hello/10'), 'Request Regex()' ); 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' ); } { # Test LocalRegex(w/o optional capture) ok( my $response = request('http://localhost/action/regexp/mandatory'), 'Request LocalRegex()' ); 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' ); } { # Test LocalRegex(w/ optional capture) ok( my $response = request('http://localhost/action/regexp/mandatory/optional'), 'Request LocalRegex()' ); 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' ); } # { # Test localregex in the root controller # ok( my $response = request('http://localhost/localregex'), # 'Request' ); # ok( $response->is_success, '... Response Successful 2xx' ); # is( $response->content_type, 'text/plain', '... Response Content-Type' ); # is( $response->header('X-Catalyst-Action'), # '^localregex$', '... Test Action' ); # is( # $response->header('X-Test-Class'), # 'TestApp::Controller::Root', # '... Test Class' # ); # } { # Test Regex(w/ captures) and redirect my $url = 'http://localhost/action/regexp/redirect/life/universe/42/everything'; ok( my $response = request($url), 'Request Regex(w/ captures)' ); ok( $response->is_redirect, '... Response is redirect' ); is( $response->header('X-Catalyst-Action'), '^action/regexp/redirect/(\w+)/universe/(\d+)/everything$', '... Test Action' ); is( $response->header('X-Test-Class'), 'TestApp::Controller::Action::Regexp', '... Test Class' ); is( $response->header('location'), $response->request->uri, '... Redirect URI is the same as the request URI' ); } } Catalyst-DispatchType-Regex-5.90035/t/aggregate/live_priorities.t000444000765000024 542612506524042 25013 0ustar00mgrimesstaff000000000000#!perl use strict; use warnings; use FindBin; use lib "$FindBin::Bin/../lib"; use Test::More; # This kludge is necessary to avoid failing due to circular dependencies # with Catalyst-Runtime. Not ideal, but until we remove CDR from # Catalyst-Runtime prereqs, this is necessary to avoid Catalyst-Runtime build # failing. BEGIN { plan skip_all => 'Catalyst::Runtime required' unless eval { require Catalyst }; plan skip_all => 'Test requires Catalyst::Runtime >= 5.90030' unless $Catalyst::VERSION >= 5.90030; plan tests => 12; } use Catalyst::Test 'TestApp'; 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' }, # After refactoring, priorities depend on the order the DispatchType # (Regex/Regexp/LocalRegex/LocalRegexp) is found in the controllers. 'Regex vs. Path', { path => '/re_vs_path', expect => 'path' }, 'Local vs. LocalRegex', { path => '/loc_vs_locre', expect => 'local' }, 'Path vs. LocalRegex', { path => '/path_vs_locre', expect => 'path' }, # index 'index vs. Regex', { path => '/re_vs_index', expect => 'index' }, 'index vs. LocalRegex', { path => '/locre_vs_index', expect => 'index' }, ); 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)' : '' ) ); } } Catalyst-DispatchType-Regex-5.90035/t/aggregate/unit_core_uri_for_action.t000444000765000024 417012506524042 26647 0ustar00mgrimesstaff000000000000#!perl use strict; use warnings; use FindBin; use lib "$FindBin::Bin/../lib"; use Test::More; # This kludge is necessary to avoid failing due to circular dependencies # with Catalyst-Runtime. Not ideal, but until we remove CDR from # Catalyst-Runtime prereqs, this is necessary to avoid Catalyst-Runtime build # failing. BEGIN { plan skip_all => 'Catalyst::Runtime required' unless eval { require Catalyst }; plan skip_all => 'Test requires Catalyst::Runtime >= 5.90030' unless $Catalyst::VERSION >= 5.90030; } use_ok('TestApp'); my $dispatcher = TestApp->dispatcher; # # 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"); my $regex_action_bs = $dispatcher->get_action_by_path( '/action/regexp/one_backslashes' ); ok(!defined($dispatcher->uri_for_action($regex_action_bs)), "Regex action without captures returns undef"); ok(!defined($dispatcher->uri_for_action($regex_action_bs, [ 1, 2, 3 ])), "Regex action with too many captures returns undef"); is($dispatcher->uri_for_action($regex_action_bs, [ 'foo', 123 ]), "/action/regexp/foo/123.html", "Regex action interpolates captures correctly"); # # Tests with Context # my $request = Catalyst::Request->new( { _log => Catalyst::Log->new, base => URI->new('http://127.0.0.1/foo') } ); my $context = TestApp->new( { request => $request, namespace => 'yada', } ); 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"); done_testing; Catalyst-DispatchType-Regex-5.90035/t/lib000755000765000024 012506524042 20072 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp.pm000444000765000024 363412506524042 22153 0ustar00mgrimesstaff000000000000package TestApp; use strict; use Catalyst qw/ Test::Headers /; use Catalyst::Utils; use Moose; use namespace::autoclean; our $VERSION = '0.01'; TestApp->config( name => 'TestApp', root => '/some/dir', use_request_uri_for_path => 1, # 'Controller::Action::Action' => { # action_args => { # action_action_nine => { another_extra_arg => 13 } # } # } ); TestApp->setup; sub execute { my $c = shift; my $class = ref( $c->component( $_[0] ) ) || $_[0]; my $action = $_[1]->reverse; my $method; if ( $action =~ /->(\w+)$/ ) { $method = $1; } elsif ( $action =~ /\/(\w+)$/ ) { $method = $1; } elsif ( $action =~ /^(\w+)$/ ) { $method = $action; } if ( $class && $method && $method !~ /^_/ ) { my $executed = sprintf( "%s->%s", $class, $method ); my @executed = $c->response->headers->header('X-Catalyst-Executed'); push @executed, $executed; $c->response->headers->header( 'X-Catalyst-Executed' => join ', ', @executed ); } no warnings 'recursion'; return $c->SUPER::execute(@_); } # Replace the very large HTML error page with # useful info if something crashes during a test sub finalize_error { my $c = shift; $c->next::method(@_); $c->res->status(500); $c->res->body( 'FATAL ERROR: ' . join( ', ', @{ $c->error } ) ); } { no warnings 'redefine'; sub Catalyst::Log::error { } } # Pretend to be Plugin::Session and hook finalize_headers to send a header sub finalize_headers { my $c = shift; $c->res->header('X-Test-Header', 'valid'); my $call_count = $c->stash->{finalize_headers_call_count} || 0; $call_count++; $c->stash(finalize_headers_call_count => $call_count); $c->res->header('X-Test-Header-Call-Count' => $call_count); return $c->maybe::next::method(@_); } 1; Catalyst-DispatchType-Regex-5.90035/t/lib/Catalyst000755000765000024 012506524042 21656 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/t/lib/Catalyst/Plugin000755000765000024 012506524042 23114 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/t/lib/Catalyst/Plugin/Test000755000765000024 012506524042 24033 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/t/lib/Catalyst/Plugin/Test/Headers.pm000444000765000024 137012506524042 26102 0ustar00mgrimesstaff000000000000package Catalyst::Plugin::Test::Headers; use strict; use MRO::Compat; sub prepare { my $class = shift; my $c = $class->next::method(@_); $c->response->header( 'X-Catalyst-Engine' => $c->engine ); $c->response->header( 'X-Catalyst-Debug' => $c->debug ? 1 : 0 ); { my $components = join( ', ', sort keys %{ $c->components } ); $c->response->header( 'X-Catalyst-Components' => $components ); } { no strict 'refs'; my $plugins = join ', ', $class->registered_plugins; $c->response->header( 'X-Catalyst-Plugins' => $plugins ); } return $c; } sub prepare_action { my $c = shift; $c->next::method(@_); $c->res->header( 'X-Catalyst-Action' => $c->req->action ); } 1; Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp000755000765000024 012506524042 21452 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp/Controller000755000765000024 012506524042 23575 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp/Controller/Action.pm000444000765000024 61312506524042 25465 0ustar00mgrimesstaff000000000000package TestApp::Controller::Action; use strict; use base 'Catalyst::Controller'; sub begin : Private { my ( $self, $c ) = @_; $c->res->header( 'X-Test-Class' => ref($self) ); $c->response->content_type('text/plain; charset=utf-8'); } sub default : Private { my ( $self, $c ) = @_; $c->res->output("Error - TestApp::Controller::Action\n"); $c->res->status(404); } 1; Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp/Controller/Priorities.pm000444000765000024 253212506524042 26423 0ustar00mgrimesstaff000000000000package TestApp::Controller::Priorities; use strict; use base 'Catalyst::Controller'; # # Regex vs. Local # sub re_vs_loc_re :Regex('/priorities/re_vs_loc') { $_[1]->res->body( 'regex' ) } sub re_vs_loc :Local { $_[1]->res->body( 'local' ) } # # Regex vs. LocalRegex # sub re_vs_locre_locre :LocalRegex('re_vs_(locre)') { $_[1]->res->body( 'local_regex' ) } sub re_vs_locre_re :Regex('/priorities/re_vs_locre') { $_[1]->res->body( 'regex' ) } # # Regex vs. Path # sub re_vs_path_path :Path('/priorities/re_vs_path') { $_[1]->res->body( 'path' ) } sub re_vs_path_re :Regex('/priorities/re_vs_path') { $_[1]->res->body( 'regex' ) } # # Local vs. LocalRegex # sub loc_vs_locre_locre :LocalRegex('loc_vs_locre') { $_[1]->res->body( 'local_regex' ) } sub loc_vs_locre :Local { $_[1]->res->body( 'local' ) } # # Path vs. LocalRegex # sub path_vs_locre_locre :LocalRegex('path_vs_(locre)') { $_[1]->res->body( 'local_regex' ) } sub path_vs_locre_path :Path('/priorities/path_vs_locre') { $_[1]->res->body( 'path' ) } # # Regex vs. index (has sub controller) # sub re_vs_idx :Regex('/priorities/re_vs_index') { $_[1]->res->body( 'regex' ) } # # LocalRegex vs. index (has sub controller) # sub locre_vs_idx :LocalRegex('locre_vs_index') { $_[1]->res->body( 'local_regex' ) } 1; Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp/Controller/Action000755000765000024 012506524042 25012 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp/Controller/Action/Regexp.pm000444000765000024 177412506524042 26750 0ustar00mgrimesstaff000000000000package TestApp::Controller::Action::Regexp; use strict; use base 'TestApp::Controller::Action'; sub zero : Path('zero') { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub one : Action Regex('^action/regexp/(\w+)/(\d+)$') { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub two : Action LocalRegexp('^(\d+)/(\w+)$') { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub three : Action LocalRegex('^(mandatory)(/optional)?$'){ my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } sub four : Action Regexp('^action/regexp/redirect/(\w+)/universe/(\d+)/everything$') { my ( $self, $c ) = @_; $c->res->redirect( $c->uri_for($c->action, $c->req->captures, @{$c->req->arguments}, $c->req->params ) ); } sub one_backslashes : Action Regex('^action/regexp/(\w+)/(\d+)\.html$') { my ( $self, $c ) = @_; $c->forward('TestApp::View::Dump::Request'); } 1; Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp/Controller/Priorities000755000765000024 012506524042 25726 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp/Controller/Priorities/locre_vs_index.pm000444000765000024 23712506524042 31406 0ustar00mgrimesstaff000000000000package TestApp::Controller::Priorities::locre_vs_index; use strict; use base 'Catalyst::Controller'; sub index :Private { $_[1]->res->body( 'index' ) } 1; Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp/Controller/Priorities/re_vs_index.pm000444000765000024 23412506524042 30705 0ustar00mgrimesstaff000000000000package TestApp::Controller::Priorities::re_vs_index; use strict; use base 'Catalyst::Controller'; sub index :Private { $_[1]->res->body( 'index' ) } 1; Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp/View000755000765000024 012506524042 22364 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp/View/Dump.pm000444000765000024 271612506524042 23772 0ustar00mgrimesstaff000000000000package TestApp::View::Dump; use strict; use base 'Catalyst::View'; use Data::Dumper (); use Scalar::Util qw(blessed weaken); sub dump { my ( $self, $reference, $purity ) = @_; return unless $reference; $purity = defined $purity ? $purity : 1; my $dumper = Data::Dumper->new( [$reference] ); $dumper->Indent(1); $dumper->Purity($purity); $dumper->Useqq(0); $dumper->Deepcopy(1); $dumper->Quotekeys(1); $dumper->Terse(1); local $SIG{ __WARN__ } = sub { warn unless $_[ 0 ] =~ m{dummy} }; return $dumper->Dump; } sub process { my ( $self, $c, $reference, $purity ) = @_; # Force processing of on-demand data $c->prepare_body; # Remove body from reference if needed $reference->{__body_type} = blessed $reference->body if (blessed $reference->{_body}); my $body = delete $reference->{_body}; # Remove context from reference if needed my $context = delete $reference->{_context}; if ( my $output = $self->dump( $reference, $purity ) ) { $c->res->headers->content_type('text/plain'); $c->res->output($output); if ($context) { # Repair context $reference->{_context} = $context; weaken( $reference->{_context} ); } if ($body) { # Repair body delete $reference->{__body_type}; $reference->{_body} = $body; } return 1; } return 0; } 1; Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp/View/Dump000755000765000024 012506524042 23271 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp/View/Dump/Action.pm000444000765000024 27312506524042 25163 0ustar00mgrimesstaff000000000000package TestApp::View::Dump::Action; use strict; use base qw[TestApp::View::Dump]; sub process { my ( $self, $c ) = @_; return $self->SUPER::process( $c, $c->action, 0 ); } 1; Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp/View/Dump/Body.pm000444000765000024 34012506524042 24636 0ustar00mgrimesstaff000000000000package TestApp::View::Dump::Body; use strict; use base qw[TestApp::View::Dump]; sub process { my ( $self, $c ) = @_; return $self->SUPER::process( $c, $c->request->{_body} ); # FIXME, accessor doesn't work? } 1; Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp/View/Dump/Env.pm000444000765000024 101212506524042 24506 0ustar00mgrimesstaff000000000000package TestApp::View::Dump::Env; use strict; use base qw[TestApp::View::Dump]; sub process { my ( $self, $c ) = @_; my $env = $c->stash->{env}; return $self->SUPER::process($c, { map { ($_ => $env->{$_}) } grep { $_ ne 'psgi.input' } keys %{ $env }, }); } ## We override Data::Dumper here since its not reliably outputting ## something that is roundtrip-able. sub dump { my ( $self, $reference ) = @_; use Data::Dump (); return Data::Dump::dump($reference); } 1; Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp/View/Dump/Request.pm000444000765000024 33712506524042 25377 0ustar00mgrimesstaff000000000000package TestApp::View::Dump::Request; use strict; use base qw[TestApp::View::Dump]; sub process { my ( $self, $c ) = @_; my $r = $c->request; local $r->{env}; return $self->SUPER::process( $c, $r ); } 1; Catalyst-DispatchType-Regex-5.90035/t/lib/TestApp/View/Dump/Response.pm000444000765000024 40212506524042 25536 0ustar00mgrimesstaff000000000000package TestApp::View::Dump::Response; use strict; use base qw[TestApp::View::Dump]; sub process { my ( $self, $c ) = @_; my $r = $c->response; local $r->{_writer}; local $r->{_reponse_cb}; return $self->SUPER::process( $c, $r ); } 1; Catalyst-DispatchType-Regex-5.90035/xt000755000765000024 012506524042 17514 5ustar00mgrimesstaff000000000000Catalyst-DispatchType-Regex-5.90035/xt/critic.t000444000765000024 65212506524042 21276 0ustar00mgrimesstaff000000000000use strict; use warnings; use Test::More; use File::Spec; # plan( skip_all => 'Author test. Set TEST_AUTHOR to a true value to run.' ) # unless $ENV{TEST_AUTHOR}; eval { require Test::Perl::Critic; }; plan( skip_all => ' Test::Perl::Critic required to criticise code ' ) if $@; my $rcfile = File::Spec->catfile( 'xt', 'perlcriticrc' ); Test::Perl::Critic->import( -profile => $rcfile, -severity => 3 ); all_critic_ok(); Catalyst-DispatchType-Regex-5.90035/xt/fixme.t000444000765000024 120112506524042 21140 0ustar00mgrimesstaff000000000000#!/usr/bin/env perl # Check source files for FIXME statements use strict; BEGIN { $| = 1; $^W = 1; } my @MODULES = ( 'Test::Fixme 0.04', ); # Don't run tests during end-user installs use Test::More; # plan( skip_all => 'Author tests not required for installation' ) # unless ( $ENV{RELEASE_TESTING} or $ENV{AUTOMATED_TESTING} ); # Load the testing modules foreach my $MODULE (@MODULES) { eval "use $MODULE"; if ($@) { $ENV{RELEASE_TESTING} ? die("Failed to load required release-testing module $MODULE") : plan( skip_all => "$MODULE not available for testing" ); } } run_tests(); 1; Catalyst-DispatchType-Regex-5.90035/xt/hasversion.t000444000765000024 122312506524042 22215 0ustar00mgrimesstaff000000000000#!/usr/bin/env perl # Test that all modules have a version number use strict; BEGIN { $| = 1; $^W = 1; } my @MODULES = ( 'Test::HasVersion 0.012', ); # Don't run tests during end-user installs use Test::More; # plan( skip_all => 'Author tests not required for installation' ) # unless ( $ENV{RELEASE_TESTING} or $ENV{AUTOMATED_TESTING} ); # Load the testing modules foreach my $MODULE (@MODULES) { eval "use $MODULE"; if ($@) { $ENV{RELEASE_TESTING} ? die("Failed to load required release-testing module $MODULE") : plan( skip_all => "$MODULE not available for testing" ); } } all_pm_version_ok(); 1; Catalyst-DispatchType-Regex-5.90035/xt/manifest.t000444000765000024 116412506524042 21646 0ustar00mgrimesstaff000000000000#!/usr/bin/env perl # Test that the module MANIFEST is up-to-date use strict; BEGIN { $| = 1; $^W = 1; } my @MODULES = ( 'Test::DistManifest 1.003', ); # Don't run tests during end-user installs use Test::More; # plan( skip_all => 'Author tests not required for installation' ) # unless ( $ENV{RELEASE_TESTING} ); # Load the testing modules foreach my $MODULE (@MODULES) { eval "use $MODULE"; if ($@) { $ENV{RELEASE_TESTING} ? die("Failed to load required release-testing module $MODULE") : plan( skip_all => "$MODULE not available for testing" ); } } manifest_ok(); 1; Catalyst-DispatchType-Regex-5.90035/xt/meta.t000444000765000024 122712506524042 20766 0ustar00mgrimesstaff000000000000#!/usr/bin/env perl # Test that our META.yml file matches the specification use strict; BEGIN { $| = 1; $^W = 1; } my @MODULES = ( 'Test::CPAN::Meta 0.12', ); # Don't run tests during end-user installs use Test::More; # plan( skip_all => 'Author tests not required for installation' ) # unless ( $ENV{RELEASE_TESTING} or $ENV{AUTOMATED_TESTING} ); # Load the testing modules foreach my $MODULE (@MODULES) { eval "use $MODULE"; if ($@) { $ENV{RELEASE_TESTING} ? die("Failed to load required release-testing module $MODULE") : plan( skip_all => "$MODULE not available for testing" ); } } meta_yaml_ok(); 1; Catalyst-DispatchType-Regex-5.90035/xt/minimumversion.t000444000765000024 133112506524042 23115 0ustar00mgrimesstaff000000000000#!/usr/bin/env perl # Test that our declared minimum Perl version matches our syntax use strict; BEGIN { $| = 1; $^W = 1; } my @MODULES = ( 'Perl::MinimumVersion 1.20', 'Test::MinimumVersion 0.008', ); # Don't run tests during end-user installs use Test::More; # plan( skip_all => 'Author tests not required for installation' ) # unless ( $ENV{RELEASE_TESTING} or $ENV{AUTOMATED_TESTING} ); # Load the testing modules foreach my $MODULE (@MODULES) { eval "use $MODULE"; if ($@) { $ENV{RELEASE_TESTING} ? die("Failed to load required release-testing module $MODULE") : plan( skip_all => "$MODULE not available for testing" ); } } all_minimum_version_from_metayml_ok(); 1; Catalyst-DispatchType-Regex-5.90035/xt/perlcriticrc000444000765000024 4212506524042 22215 0ustar00mgrimesstaff000000000000# [-CodeLayout::ProhibitHardTabs] Catalyst-DispatchType-Regex-5.90035/xt/pod-coverage.t000444000765000024 202512506524042 22410 0ustar00mgrimesstaff000000000000#!/usr/bin/env perl # Ensure pod coverage in your distribution use strict; BEGIN { $| = 1; $^W = 1; } my @MODULES = ( 'Test::Pod::Coverage 1.08', "Pod::Coverage::TrustPod 0.10" ); # Don't run tests during end-user installs use Test::More; # plan( skip_all => 'Author tests not required for installation' ) # unless ( $ENV{RELEASE_TESTING} ); # Load the testing modules foreach my $MODULE (@MODULES) { eval "use $MODULE"; if ($@) { $ENV{RELEASE_TESTING} ? die("Failed to load required release-testing module $MODULE") : plan( skip_all => "$MODULE not available for testing" ); } } # Skip platform specific modules unless we are on that platform # Don't require any pod for Moose BUILD subs pod_coverage_ok( $_, { trustme => ['BUILD'], coverage_class => 'Pod::Coverage::TrustPod' } ) for grep { not( ( $^O ne 'linux' && $_ =~ /Linux$/ ) or ( $^O ne 'darwin' && $_ =~ /Mac$/ ) or ( $^O ne 'freebsd' && $_ =~ /FreeBSD$/ ) ) } all_modules(); done_testing; 1; Catalyst-DispatchType-Regex-5.90035/xt/pod.t000444000765000024 125112506524042 20617 0ustar00mgrimesstaff000000000000#!/usr/bin/env perl # Test that the syntax of our POD documentation is valid use strict; BEGIN { $| = 1; $^W = 1; } my @MODULES = ( 'Pod::Simple 3.07', 'Test::Pod 1.26', ); # Don't run tests during end-user installs use Test::More; # plan( skip_all => 'Author tests not required for installation' ) # unless ( $ENV{RELEASE_TESTING} or $ENV{AUTOMATED_TESTING} ); # Load the testing modules foreach my $MODULE (@MODULES) { eval "use $MODULE"; if ($@) { $ENV{RELEASE_TESTING} ? die("Failed to load required release-testing module $MODULE") : plan( skip_all => "$MODULE not available for testing" ); } } all_pod_files_ok(); 1;