From: Graham Knop Date: Thu, 12 Apr 2018 15:38:16 +0000 (+0200) Subject: whitespace cleanup X-Git-Tag: v5.90118~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=88e5a8b0c4d28e46b8ba6b6b9567063e57af9063 whitespace cleanup --- diff --git a/lib/Catalyst.pm b/lib/Catalyst.pm index 57d4928..860822e 100644 --- a/lib/Catalyst.pm +++ b/lib/Catalyst.pm @@ -125,7 +125,7 @@ sub _build_response_constructor_args { sub composed_response_class { my $class = shift; return $class->_composed_response_class if $class->_composed_response_class; - + my @traits = (@{$class->response_class_traits||[]}, @{$class->config->{response_class_traits}||[]}); my $trait_ns = 'TraitFor::Response'; @@ -165,7 +165,7 @@ our $RECURSION = 1000; our $DETACH = Catalyst::Exception::Detach->new; our $GO = Catalyst::Exception::Go->new; -#I imagine that very few of these really +#I imagine that very few of these really #need to be class variables. if any. #maybe we should just make them attributes with a default? __PACKAGE__->mk_classdata($_) @@ -1432,9 +1432,9 @@ EOF } my @middleware = map { - ref $_ eq 'CODE' ? - "Inline Coderef" : - (ref($_) .' '. ($_->can('VERSION') ? $_->VERSION || '' : '') + ref $_ eq 'CODE' ? + "Inline Coderef" : + (ref($_) .' '. ($_->can('VERSION') ? $_->VERSION || '' : '') || '') } $class->registered_middlewares; if (@middleware) { @@ -2300,7 +2300,7 @@ sub finalize_encoding { # to do this early since encodable_response is false for this condition and we need # to match the debug output for backcompat (there's a test for this...) -JNAP if( - $res->content_type_charset and $c->encoding and + $res->content_type_charset and $c->encoding and (uc($c->encoding->mime_name) ne uc($res->content_type_charset)) ) { my $ct = lc($res->content_type_charset); @@ -2321,7 +2321,7 @@ sub finalize_encoding { $c->res->body( $c->encoding->encode( $c->res->body, $c->_encode_check ) ); # Set the charset if necessary. This might be a bit bonkers since encodable response - # is false when the set charset is not the same as the encoding mimetype (maybe + # is false when the set charset is not the same as the encoding mimetype (maybe # confusing action at a distance here.. # Don't try to set the charset if one already exists or if headers are already finalized $c->res->content_type($c->res->content_type . "; charset=" . $c->encoding->mime_name) @@ -2877,7 +2877,7 @@ We try each possible role in turn (and throw an error if none load) The namespace part 'TraitFor::Request' was chosen to assist in backwards compatibility with L which previously provided these features in a stand alone package. - + =head2 $app->composed_request_class This is the request class which has been composed with any request_class_traits. @@ -3237,7 +3237,7 @@ sub setup_component { $class->components->{ $component } = $class->setup_component($component); } - return $instance; + return $instance; } =head2 $app->config_for( $component_name ) @@ -3362,7 +3362,7 @@ sub setup_engine { return; } -## This exists just to supply a prebuild psgi app for mod_perl and for the +## This exists just to supply a prebuild psgi app for mod_perl and for the ## build in server support (back compat support for pre psgi port behavior). ## This is so that we don't build a new psgi app for each request when using ## the mod_perl handler or the built in servers (http and fcgi, etc). @@ -3379,7 +3379,7 @@ sub _finalized_psgi_app { } ## Look for a psgi file like 'myapp_web.psgi' (if the app is MyApp::Web) in the -## home directory and load that and return it (just assume it is doing the +## home directory and load that and return it (just assume it is doing the ## right thing :) ). If that does not exist, call $app->psgi_app, wrap that ## in default_middleware and return it ( this is for backward compatibility ## with pre psgi port behavior ). @@ -4058,7 +4058,7 @@ sub default_data_handlers { my ($fh, $req) = @_; require JSON::MaybeXS; my $slurped; - return eval { + return eval { local $/; $slurped = $fh->getline; JSON::MaybeXS::decode_json($slurped); # decode_json does utf8 decoding for us @@ -4347,7 +4347,7 @@ that does not contain uploads, but instead contains inlined complex data (very uncommon) we cannot reliably convert that into field => value pairs. So instead we create an instance of L. If this causes issue for you, you can disable this by setting C -to true (default is false). +to true (default is false). =item * @@ -4368,7 +4368,7 @@ request URL query or keywords. Most readings of the relevant specifications suggest these should be UTF-* encoded, which is the default that L will use, however if you are creating a lot of URLs manually or have external evil clients, this might cause you trouble. If you find the changes introduced -in Catalyst version 5.90080+ break some of your query code, you may disable +in Catalyst version 5.90080+ break some of your query code, you may disable the UTF-8 decoding globally using this configuration. This setting takes precedence over C @@ -4585,17 +4585,17 @@ option, C, which lets you associate a content type with a coderef that parses that content type into something Perl can readily access. package MyApp::Web; - + use Catalyst; use JSON::MaybeXS; - + __PACKAGE__->config( data_handlers => { 'application/json' => sub { local $/; decode_json $_->getline }, }, ## Any other configuration. ); - + __PACKAGE__->setup; By default L comes with a generic JSON data handler similar to the @@ -4621,12 +4621,12 @@ arrayref under the configuration key C. Here's an example with details to follow: package MyApp::Web; - + use Catalyst; use Plack::Middleware::StackTrace; - + my $stacktrace_middleware = Plack::Middleware::StackTrace->new; - + __PACKAGE__->config( 'psgi_middleware', [ 'Debug', @@ -4643,7 +4643,7 @@ with details to follow: }, ], ); - + __PACKAGE__->setup; So the general form is: @@ -4669,26 +4669,26 @@ middleware will wrap closer to the application). Keep this in mind since in some cases the order of middleware is important. The two approaches are not exclusive. - + =over 4 - + =item Middleware Object - + An already initialized object that conforms to the L specification: - + my $stacktrace_middleware = Plack::Middleware::StackTrace->new; - + __PACKAGE__->config( 'psgi_middleware', [ $stacktrace_middleware, ]); - - + + =item coderef - + A coderef that is an inlined middleware: - + __PACKAGE__->config( 'psgi_middleware', [ sub { @@ -4705,11 +4705,11 @@ A coderef that is an inlined middleware: }, }, ]); - - - + + + =item a scalar - + We assume the scalar refers to a namespace after normalizing it using the following rules: @@ -4740,12 +4740,12 @@ Examples: '+MyApp::Custom', ## MyApp::Custom->wrap ], ); - + =item a scalar followed by a hashref - + Just like the previous, except the following C is used as arguments to initialize the middleware object. - + __PACKAGE__->config( 'psgi_middleware', [ 'Session' => {store => 'File'}, diff --git a/lib/Catalyst/Action.pm b/lib/Catalyst/Action.pm index fd4aa1c..c0e2a43 100644 --- a/lib/Catalyst/Action.pm +++ b/lib/Catalyst/Action.pm @@ -261,7 +261,7 @@ sub resolve_type_constraint { my $tc = Type::Registry->new->foreign_lookup($name); return defined $tc ? $tc : die "'$name' not a full namespace type constraint in ${\$self->private_path}"; } - + my @tc = grep { defined $_ } (eval("package ${\$self->class}; $name")); unless(scalar @tc) { @@ -289,10 +289,10 @@ sub resolve_type_constraint { } else { return; } - } + } } } - + my $classes = join(',', $self->class, @roles, @supers); die "'$name' not a type constraint in '${\$self->private_path}', Looked in: $classes"; } @@ -470,7 +470,7 @@ sub list_extra_info { Args => $self->normalized_arg_number, CaptureArgs => $self->number_of_captures, } -} +} __PACKAGE__->meta->make_immutable; diff --git a/lib/Catalyst/ActionRole/ConsumesContent.pm b/lib/Catalyst/ActionRole/ConsumesContent.pm index 07315c8..28b5350 100644 --- a/lib/Catalyst/ActionRole/ConsumesContent.pm +++ b/lib/Catalyst/ActionRole/ConsumesContent.pm @@ -65,7 +65,7 @@ sub can_consume { around 'list_extra_info' => sub { my ($orig, $self, @args) = @_; return { - %{ $self->$orig(@args) }, + %{ $self->$orig(@args) }, CONSUMES => $self->allowed_content_types, }; }; @@ -87,7 +87,7 @@ Catalyst::ActionRole::ConsumesContent - Match on HTTP Request Content-Type sub is_json : Chained('start') Consumes('application/json') { ... } sub is_urlencoded : Chained('start') Consumes('application/x-www-form-urlencoded') { ... } sub is_multipart : Chained('start') Consumes('multipart/form-data') { ... } - + ## Alternatively, for common types... sub is_json : Chained('start') Consume(JSON) { ... } @@ -95,13 +95,13 @@ Catalyst::ActionRole::ConsumesContent - Match on HTTP Request Content-Type sub is_multipart : Chained('start') Consumes(Multipart) { ... } ## Or allow more than one type - + sub is_more_than_one : Chained('start') : Consumes('application/x-www-form-urlencoded') : Consumes('multipart/form-data') { - ## ... + ## ... } 1; @@ -109,7 +109,7 @@ Catalyst::ActionRole::ConsumesContent - Match on HTTP Request Content-Type =head1 DESCRIPTION This is an action role that lets your L match on the content -type of the incoming request. +type of the incoming request. Generally when there's a PUT or POST request, there's a request content body with a matching MIME content type. Commonly this will be one of the types diff --git a/lib/Catalyst/ActionRole/HTTPMethods.pm b/lib/Catalyst/ActionRole/HTTPMethods.pm index 9558223..f189b34 100644 --- a/lib/Catalyst/ActionRole/HTTPMethods.pm +++ b/lib/Catalyst/ActionRole/HTTPMethods.pm @@ -24,7 +24,7 @@ around ['match','match_captures'] => sub { around 'list_extra_info' => sub { my ($orig, $self, @args) = @_; return { - %{ $self->$orig(@args) }, + %{ $self->$orig(@args) }, HTTP_METHODS => [sort $self->allowed_http_methods], }; }; diff --git a/lib/Catalyst/ActionRole/QueryMatching.pm b/lib/Catalyst/ActionRole/QueryMatching.pm index 955258b..12dab23 100644 --- a/lib/Catalyst/ActionRole/QueryMatching.pm +++ b/lib/Catalyst/ActionRole/QueryMatching.pm @@ -32,12 +32,12 @@ has query_constraints => ( sub _build_query_constraints { my $self = shift; my ($constraint_proto, @extra) = $self->_query_attr; - + die "Action ${\$self->private_path} defines more than one 'Query' attribute" if scalar @extra; return +{} unless defined($constraint_proto); $constraint_proto =~s/^(.+),\.\.\.$/$1/; # slurpy is handled elsewhere - + # Query may be a Hash like Query(p=>Int,q=>Str) OR it may be a Ref like # Query(Tuple[p=>Int, slurpy HashRef]). The only way to figure is to eval it # and look at what we have. @@ -83,7 +83,7 @@ around ['match','match_captures'] => sub { around 'list_extra_info' => sub { my ($orig, $self, @args) = @_; return { - %{ $self->$orig(@args) }, + %{ $self->$orig(@args) }, }; }; diff --git a/lib/Catalyst/Controller.pm b/lib/Catalyst/Controller.pm index f65ee10..34ad350 100644 --- a/lib/Catalyst/Controller.pm +++ b/lib/Catalyst/Controller.pm @@ -157,7 +157,7 @@ sub _AUTO : Private { # We FORCE the auto action user to explicitly return # true. We need to do this since there's some auto # users (Catalyst::Authentication::Credential::HTTP) that - # actually do a detach instead. + # actually do a detach instead. $c->state(0); $auto->dispatch( $c ); return 0 unless $c->state; @@ -794,7 +794,7 @@ This is a general toolbox for attaching your action to a given path. =head2 Regexp B Use Chained methods or other techniques. -If you really depend on this, install the standalone +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. @@ -804,12 +804,12 @@ A global way to match a give regular expression in the incoming request path. =head2 LocalRegexp B Use Chained methods or other techniques. -If you really depend on this, install the standalone +If you really depend on this, install the standalone L distribution. Like L but scoped under the namespace of the containing controller -=head2 Chained +=head2 Chained =head2 ChainedParent @@ -933,7 +933,7 @@ that actions with an undetermined number of args match at lower precedence than with a fixed number. You may use reference types such as Tuple from L that allows you to fix the number of allowed args. For example Args(Tuple[Int,Int]) would be determined to be two args (or really the same as Args(Int,Int).) You may -find this useful for creating custom subtypes with complex matching rules that you +find this useful for creating custom subtypes with complex matching rules that you wish to reuse over many actions. See L for more. @@ -1047,7 +1047,7 @@ Allows you to customize parsing of subroutine attributes. Please note that this feature does not let you actually assign new functions to actions via subroutine attributes, but is really more for creating useful -aliases to existing core and extended attributes, and transforms based on +aliases to existing core and extended attributes, and transforms based on existing information (like from configuration). Code for actually doing something meaningful with the subroutine attributes will be located in the L classes (or your subclasses), L and diff --git a/lib/Catalyst/Delta.pod b/lib/Catalyst/Delta.pod index 045767c..19a921d 100755 --- a/lib/Catalyst/Delta.pod +++ b/lib/Catalyst/Delta.pod @@ -245,7 +245,7 @@ We have started migrating code in Catalyst to equivalent Plack Middleware when such exists and is correct to do so. For example we now use L to determine content length of a response when none is provided. This replaces similar code inlined with L -The main advantages to doing this is 1) more similar Catalyst core that is +The main advantages to doing this is 1) more similar Catalyst core that is focused on the Catalyst special sauce, 2) Middleware is more broadly shared so we benefit from better collaboration with developers outside Catalyst, 3) In the future you'll be able to change or trim the middleware stack to get @@ -263,7 +263,7 @@ which does read but not getline. For now we will just warn when encountering such an object and fallback to the previous behavior (where L itself unrolls the filehandle and performs blocking streams). However this backwards compatibility will be removed in an upcoming release so you should either -rewrite your custom filehandle objects to support getline or start using the +rewrite your custom filehandle objects to support getline or start using the middleware that adapts read for getline L. =head3 Response->headers become read-only after finalizing @@ -445,7 +445,7 @@ Below is a brief list of features which have been deprecated in this release: =head3 Restarter The development server restarter has been improved to be compatible with -immutable Moose classes, and also to optionally use +immutable Moose classes, and also to optionally use L to handle more complex application layouts correctly. @@ -475,8 +475,8 @@ Log levels have been made additive. =item * -New print method which prints @data to the output stream, separated by $,. -This lets you pass the response object to functions that want to write to an +New print method which prints @data to the output stream, separated by $,. +This lets you pass the response object to functions that want to write to an L. =item * @@ -497,7 +497,7 @@ supported and may be used in components and applications. =item * -Many reusable extensions which would previously have been plugins or base +Many reusable extensions which would previously have been plugins or base classes are better implemented as Moose roles. =item * @@ -540,7 +540,7 @@ Fixes for FastCGI when used with IIS 6.0 =item * -Fix a bug in uri_for which could cause it to generate paths with multiple +Fix a bug in uri_for which could cause it to generate paths with multiple slashes in them. =item * diff --git a/lib/Catalyst/DispatchType/Chained.pm b/lib/Catalyst/DispatchType/Chained.pm index 138727c..34faf94 100644 --- a/lib/Catalyst/DispatchType/Chained.pm +++ b/lib/Catalyst/DispatchType/Chained.pm @@ -317,12 +317,12 @@ sub recurse_match { !$best_action || @parts < @{$best_action->{parts}} || ( - !@parts && - defined($args_attr) && + !@parts && + defined($args_attr) && ( $args_count eq "0" && ( - ($c->config->{use_chained_args_0_special_case}||0) || + ($c->config->{use_chained_args_0_special_case}||0) || ( exists($best_action->{args_count}) && defined($best_action->{args_count}) ? ($best_action->{args_count} ne 0) : 1 diff --git a/lib/Catalyst/DispatchType/Path.pm b/lib/Catalyst/DispatchType/Path.pm index 38719ea..95ad12b 100644 --- a/lib/Catalyst/DispatchType/Path.pm +++ b/lib/Catalyst/DispatchType/Path.pm @@ -61,7 +61,7 @@ sub list { my $display_path = "/$path/$parts"; $display_path =~ s{/{1,}}{/}g; - $display_path =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; # deconvert urlencoded for pretty view + $display_path =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; # deconvert urlencoded for pretty view $display_path = decode_utf8 $display_path; # URI does encoding $paths->row( $display_path, "/$action" ); } diff --git a/lib/Catalyst/Engine.pm b/lib/Catalyst/Engine.pm index 70f49fb..ea85e28 100644 --- a/lib/Catalyst/Engine.pm +++ b/lib/Catalyst/Engine.pm @@ -76,7 +76,7 @@ sub finalize_body { if($res->_has_response_cb) { ## we have not called the response callback yet, so we are safe to send ## the whole body to PSGI - + my @headers; $res->headers->scan(sub { push @headers, @_ }); @@ -92,12 +92,12 @@ sub finalize_body { # In the past, Catalyst only looked for ->read not ->getline. It is very possible # that one might have an object that respected read but did not have getline. # As a result, we need to handle this case for backcompat. - + # We will just do the old loop for now. In a future version of Catalyst this support - # will be removed and one will have to rewrite their custom object or use + # will be removed and one will have to rewrite their custom object or use # Plack::Middleware::AdaptFilehandleRead. In anycase support for this is officially # deprecated and described as such as of 5.90060 - + my $got; do { $got = read $body, my ($buffer), $CHUNKSIZE; @@ -109,7 +109,7 @@ sub finalize_body { } else { # Looks like for backcompat reasons we need to be able to deal # with stringyfiable objects. - $body = ["$body"]; + $body = ["$body"]; } } elsif(ref $body) { if( (ref($body) eq 'GLOB') or (ref($body) eq 'ARRAY')) { @@ -139,7 +139,7 @@ sub finalize_body { ## for backcompat we still need to handle a ->body. I guess I could see ## someone calling ->write to presend some stuff, and then doing the rest ## via ->body, like in a template. - + ## We'll just use the old, existing code for this (or most of it) if(my $body = $res->body) { @@ -158,7 +158,7 @@ sub finalize_body { close $body; } else { - + # Case where body was set after calling ->write. We'd prefer not to # support this, but I can see some use cases with the way most of the # views work. Since body has already been encoded, we need to do @@ -249,7 +249,7 @@ sub finalize_error { $c->res->content_type('text/html; charset=utf-8'); my $name = ref($c)->config->{name} || join(' ', split('::', ref $c)); - + # Prevent Catalyst::Plugin::Unicode::Encoding from running. # This is a little nasty, but it's the best way to be clean whether or # not the user has an encoding plugin. diff --git a/lib/Catalyst/Log.pm b/lib/Catalyst/Log.pm index a599284..7d7fa5f 100644 --- a/lib/Catalyst/Log.pm +++ b/lib/Catalyst/Log.pm @@ -292,19 +292,19 @@ to use Log4Perl or another logger, you should call it like this: =head2 autoflush -When enabled (default), messages are written to the log immediately instead -of queued until the end of the request. +When enabled (default), messages are written to the log immediately instead +of queued until the end of the request. -This option, as well as C, is provided for modules such as -L to be able to programmatically +This option, as well as C, is provided for modules such as +L to be able to programmatically suppress the output of log messages. By turning off C (application-wide -setting) and then setting the C flag within a given request, all log +setting) and then setting the C flag within a given request, all log messages for the given request will be suppressed. C can still be set -independently of turning off C, however. It just means any messages -sent to the log up until that point in the request will obviously still be emitted, +independently of turning off C, however. It just means any messages +sent to the log up until that point in the request will obviously still be emitted, since C means they are written in real-time. -If you need to turn off autoflush you should do it like this (in your main app +If you need to turn off autoflush you should do it like this (in your main app class): after setup_finalize => sub { diff --git a/lib/Catalyst/Middleware/Stash.pm b/lib/Catalyst/Middleware/Stash.pm index c8d5945..1e8a3d5 100644 --- a/lib/Catalyst/Middleware/Stash.pm +++ b/lib/Catalyst/Middleware/Stash.pm @@ -41,7 +41,7 @@ sub _create_stash { sub call { my ($self, $env) = @_; - $env->{+PSGI_KEY} = $self->_create_stash + $env->{+PSGI_KEY} = $self->_create_stash unless exists($env->{+PSGI_KEY}); return $self->app->($env); diff --git a/lib/Catalyst/Request.pm b/lib/Catalyst/Request.pm index e6e8657..52314f3 100644 --- a/lib/Catalyst/Request.pm +++ b/lib/Catalyst/Request.pm @@ -141,8 +141,8 @@ sub _build_body_data { } has _use_hash_multivalue => ( - is=>'ro', - required=>1, + is=>'ro', + required=>1, default=> sub {0}); # Amount of data to read from input on each pass @@ -251,7 +251,7 @@ sub prepare_body { my ( $self ) = @_; # If previously applied middleware created the HTTP::Body object, then we - # just use that one. + # just use that one. if(my $plack_body = $self->_has_env ? $self->env->{'plack.request.http.body'} : undef) { $self->_body($plack_body); @@ -283,7 +283,7 @@ sub prepare_body { # Ok if we get this far, we have to read psgi.input into the new body # object. Lets play nice with any plack app or other downstream, so # we create a buffer unless one exists. - + my $stream_buffer; if ($self->env->{'psgix.input.buffered'}) { # Be paranoid about previous psgi middleware or apps that read the @@ -774,7 +774,7 @@ sub param { # If anything in @_ is undef, carp about that, and remove it from # the list; - + my @params = grep { defined($_) ? 1 : do {carp "You called ->params with an undefined value"; 0} } @_; if ( @params == 1 ) { @@ -1125,7 +1125,7 @@ If parameters have already been set will clear the parameters and build them aga =head2 $self->env -Access to the raw PSGI env. +Access to the raw PSGI env. =head2 meta diff --git a/lib/Catalyst/Request/PartData.pm b/lib/Catalyst/Request/PartData.pm index d6358f3..32e600b 100644 --- a/lib/Catalyst/Request/PartData.pm +++ b/lib/Catalyst/Request/PartData.pm @@ -95,7 +95,7 @@ Catalyst::Request::Upload - handles file upload requests =head1 SYNOPSIS - my $data_part = + my $data_part = To specify where Catalyst should put the temporary files, set the 'uploadtmp' option in the Catalyst config. If unset, Catalyst will use the system temp dir. diff --git a/lib/Catalyst/Response.pm b/lib/Catalyst/Response.pm index ae6049d..2399ae5 100644 --- a/lib/Catalyst/Response.pm +++ b/lib/Catalyst/Response.pm @@ -21,7 +21,7 @@ has encodable_content_type => ( has _response_cb => ( is => 'ro', - isa => 'CodeRef', + isa => 'CodeRef', writer => '_set_response_cb', clearer => '_clear_response_cb', predicate => '_has_response_cb', @@ -191,7 +191,7 @@ sub from_psgi_response { } else { return $self->write_fh; } - }); + }); } else { die "You can't set a Catalyst response from that, expect a valid PSGI response"; } @@ -239,7 +239,7 @@ will turn the Catalyst::Response into a HTTP Response and return it to the clien $c->response->body('Catalyst rocks!'); Sets or returns the output (text or binary data). If you are returning a large body, -you might want to use a L type of object (Something that implements the getline method +you might want to use a L type of object (Something that implements the getline method in the same fashion), or a filehandle GLOB. These will be passed down to the PSGI handler you are using and might be optimized using server specific abilities (for example L will attempt to server a real local file in a non blocking manner). @@ -264,7 +264,7 @@ When using a L type of object and no content length has been already set in the response headers Catalyst will make a reasonable attempt to determine the size of the Handle. Depending on the implementation of your handle object, setting the content length may fail. If it is at all possible -for you to determine the content length of your handle object, +for you to determine the content length of your handle object, it is recommended that you set the content length in the response headers yourself, which will be respected and sent by Catalyst in the response. @@ -489,7 +489,7 @@ even set a 'body' afterward. So for example you might write your HTTP headers and the HEAD section of your document and then set the body from a template driven from a database. In some cases this can seem to the client as if you had a faster overall response (but note that unless your server support chunked -body your content is likely to get queued anyway (L and most other +body your content is likely to get queued anyway (L and most other http 1.1 webservers support this). If there is an encoding set, we encode each line of the response (the default @@ -624,7 +624,7 @@ Or you can alter the regular expression using this attribute. =head2 encodable_response -Given a L return true if its one that can be encoded. +Given a L return true if its one that can be encoded. make sure there is an encoding set on the response make sure the content type is encodable diff --git a/lib/Catalyst/Response/Writer.pm b/lib/Catalyst/Response/Writer.pm index 0037461..864e5cd 100644 --- a/lib/Catalyst/Response/Writer.pm +++ b/lib/Catalyst/Response/Writer.pm @@ -45,7 +45,7 @@ These delegate to the underlying L writer object =head2 write_encoded -If the application defines a response encoding (default is UTF8) and the +If the application defines a response encoding (default is UTF8) and the content type is a type that needs to be encoded (text types like HTML or XML and Javascript) we first encode the line you want to write. This is probably the thing you want to always do. If you use the L<\write> method directly you will diff --git a/lib/Catalyst/RouteMatching.pod b/lib/Catalyst/RouteMatching.pod index 3d26706..9ca71ab 100644 --- a/lib/Catalyst/RouteMatching.pod +++ b/lib/Catalyst/RouteMatching.pod @@ -136,7 +136,7 @@ the L library that is packaged with L: use Moose; use MooseX::MethodAttributes; use Types::Standard qw/StrMatch Int/; - + extends 'Catalyst::Controller'; sub looks_like_a_date :Path('') Args(StrMatch[qr{\d\d-\d\d-\d\d}]) { @@ -296,7 +296,7 @@ actions. The only difference is that you may declare type constraints on Captur well as Args. For Example: use Types::Standard qw/Int Tuple/; - + sub chain_base :Chained(/) CaptureArgs(1) { } sub any_priority_chain :GET Chained(chain_base) PathPart('') Args(1) { } @@ -308,7 +308,7 @@ well as Args. For Example: sub any_priority_link_any :Chained(link_any) PathPart('') Args(1) { } sub int_priority_link_any :Chained(link_any) PathPart('') Args(Int) { } - + sub link_int :Chained(chain_base) PathPart('') CaptureArgs(Int) { } sub any_priority_link :Chained(link_int) PathPart('') Args(1) { } diff --git a/lib/Catalyst/UTF8.pod b/lib/Catalyst/UTF8.pod index 044a573..b5ce7bb 100644 --- a/lib/Catalyst/UTF8.pod +++ b/lib/Catalyst/UTF8.pod @@ -151,24 +151,24 @@ What Catalyst does with UTF8 in your GET and classic HTML Form POST The same rules that we find in URL paths also cover URL query parts. That is if one types a URL like this into the browser - http://localhost/example?♥=♥♥ + http://localhost/example?♥=♥♥ When this goes 'over the wire' to your application server its going to be as percent encoded bytes: - http://localhost/example?%E2%99%A5=%E2%99%A5%E2%99%A5 + http://localhost/example?%E2%99%A5=%E2%99%A5%E2%99%A5 When L encounters this we decode the percent encoding and the utf8 so that we can properly display this information (such as in the debugging logs or in a response.) - [debug] Query Parameters are: - .-------------------------------------+--------------------------------------. - | Parameter | Value | - +-------------------------------------+--------------------------------------+ - | ♥ | ♥♥ | - '-------------------------------------+--------------------------------------' + [debug] Query Parameters are: + .-------------------------------------+--------------------------------------. + | Parameter | Value | + +-------------------------------------+--------------------------------------+ + | ♥ | ♥♥ | + '-------------------------------------+--------------------------------------' All the values and keys that are part of $c->req->query_parameters will be utf8 decoded. So you should not need to do anything special to take those @@ -182,13 +182,13 @@ the byte length. Just like with arguments and captures, you can use utf8 literals (or utf8 strings) in $c->uri_for: - use utf8; - my $url = $c->uri_for( $c->controller('Root')->action_for('example'), {'♥' => '♥♥'}); + use utf8; + my $url = $c->uri_for( $c->controller('Root')->action_for('example'), {'♥' => '♥♥'}); When you stringify this object (for use in a template, for example) it will automatically do the right thing regarding utf8 encoding and url encoding. - http://localhost/example?%E2%99%A5=%E2%99%A5%E2%99%A5 + http://localhost/example?%E2%99%A5=%E2%99%A5%E2%99%A5 Since again what you want is a properly url encoded version of this. Ultimately what you want to send over the wire via HTTP needs to be bytes (not unicode characters). @@ -230,10 +230,10 @@ assumption and decode accordingly (unless you explicitly turn off encoding...) running Catalyst in developer debug, then you will see the correct unicode characters in the debug output. For example if you generate a POST request: - use Catalyst::Test 'MyApp'; - use utf8; + use Catalyst::Test 'MyApp'; + use utf8; - my $res = request POST "/example/posted", ['♥'=>'♥', '♥♥'=>'♥']; + my $res = request POST "/example/posted", ['♥'=>'♥', '♥♥'=>'♥']; Running in CATALYST_DEBUG=1 mode you should see output like this: @@ -247,20 +247,20 @@ Running in CATALYST_DEBUG=1 mode you should see output like this: And if you had a controller like this: - package MyApp::Controller::Example; + package MyApp::Controller::Example; - use base 'Catalyst::Controller'; + use base 'Catalyst::Controller'; - sub posted :POST Local { - my ($self, $c) = @_; - $c->res->content_type('text/plain'); - $c->res->body("hearts => ${\$c->req->post_parameters->{♥}}"); - } + sub posted :POST Local { + my ($self, $c) = @_; + $c->res->content_type('text/plain'); + $c->res->body("hearts => ${\$c->req->post_parameters->{♥}}"); + } The following test case would be true: - use Encode 2.21 'decode_utf8'; - is decode_utf8($req->content), 'hearts => ♥'; + use Encode 2.21 'decode_utf8'; + is decode_utf8($req->content), 'hearts => ♥'; In this case we decode so that we can print and compare strings with multibyte characters. @@ -311,7 +311,7 @@ header information. In these cases we will try to inspect the meta data and do right thing (in the above case we'd use SHIFT_JIS to decode, not UTF-8). However if after inspecting the headers we cannot figure out how to decode the data, in those cases it will not attempt to apply decoding to the form values. Instead the part will be represented as -an instance of an object L which will contain all the header +an instance of an object L which will contain all the header information needed for you to perform custom parser of the data. Ideally we'd fix L to be smarter about decoding so please submit your cases of @@ -325,43 +325,43 @@ determine when that is needed. =head2 Summary - use utf8; - use warnings; - use strict; + use utf8; + use warnings; + use strict; - package MyApp::Controller::Root; + package MyApp::Controller::Root; - use base 'Catalyst::Controller'; - use File::Spec; + use base 'Catalyst::Controller'; + use File::Spec; - sub scalar_body :Local { - my ($self, $c) = @_; - $c->response->content_type('text/html'); - $c->response->body("

This is scalar_body action ♥

"); - } + sub scalar_body :Local { + my ($self, $c) = @_; + $c->response->content_type('text/html'); + $c->response->body("

This is scalar_body action ♥

"); + } - sub stream_write :Local { - my ($self, $c) = @_; - $c->response->content_type('text/html'); - $c->response->write("

This is stream_write action ♥

"); - } + sub stream_write :Local { + my ($self, $c) = @_; + $c->response->content_type('text/html'); + $c->response->write("

This is stream_write action ♥

"); + } - sub stream_write_fh :Local { - my ($self, $c) = @_; - $c->response->content_type('text/html'); + sub stream_write_fh :Local { + my ($self, $c) = @_; + $c->response->content_type('text/html'); - my $writer = $c->res->write_fh; - $writer->write_encoded('

This is stream_write_fh action ♥

'); - $writer->close; - } + my $writer = $c->res->write_fh; + $writer->write_encoded('

This is stream_write_fh action ♥

'); + $writer->close; + } - sub stream_body_fh :Local { - my ($self, $c) = @_; - my $path = File::Spec->catfile('t', 'utf8.txt'); - open(my $fh, '<', $path) || die "trouble: $!"; - $c->response->content_type('text/html'); - $c->response->body($fh); - } + sub stream_body_fh :Local { + my ($self, $c) = @_; + my $path = File::Spec->catfile('t', 'utf8.txt'); + open(my $fh, '<', $path) || die "trouble: $!"; + $c->response->content_type('text/html'); + $c->response->body($fh); + } =head2 Discussion @@ -402,13 +402,13 @@ L supports several methods of supplying your response with body conten and currently most common is to set the L ->body with a scalar string ( as in the example): - use utf8; + use utf8; - sub scalar_body :Local { - my ($self, $c) = @_; - $c->response->content_type('text/html'); - $c->response->body("

This is scalar_body action ♥

"); - } + sub scalar_body :Local { + my ($self, $c) = @_; + $c->response->content_type('text/html'); + $c->response->body("

This is scalar_body action ♥

"); + } In general you should need to do nothing else since L will automatically encode this string during body finalization. The only matter to watch out for is to make sure @@ -425,10 +425,10 @@ you can override this for a given response. For example here's how to override encoding and set the correct character set in the response: sub override_encoding :Local { - my ($self, $c) = @_; - $c->res->content_type('text/plain'); - $c->encoding(Encode::find_encoding('Shift_JIS')); - $c->response->body("テスト"); + my ($self, $c) = @_; + $c->res->content_type('text/plain'); + $c->encoding(Encode::find_encoding('Shift_JIS')); + $c->response->body("テスト"); } This will use the alternative encoding for a single response. @@ -454,11 +454,11 @@ that before anything else! The first streaming method is to use the C method on the response object. This method allows 'inlined' streaming and is generally used with blocking style servers. - sub stream_write :Local { - my ($self, $c) = @_; - $c->response->content_type('text/html'); - $c->response->write("

This is stream_write action ♥

"); - } + sub stream_write :Local { + my ($self, $c) = @_; + $c->response->content_type('text/html'); + $c->response->write("

This is stream_write action ♥

"); + } You may call the C method as often as you need to finish streaming all your content. L will encode each line in turn as long as the content-type meets the 'encodable types' @@ -476,14 +476,14 @@ stuff with encoding this is likely to just already do the correct thing. The second way to stream a response is to get the response writer object and invoke methods on that directly: - sub stream_write_fh :Local { - my ($self, $c) = @_; - $c->response->content_type('text/html'); + sub stream_write_fh :Local { + my ($self, $c) = @_; + $c->response->content_type('text/html'); - my $writer = $c->res->write_fh; - $writer->write_encoded('

This is stream_write_fh action ♥

'); - $writer->close; - } + my $writer = $c->res->write_fh; + $writer->write_encoded('

This is stream_write_fh action ♥

'); + $writer->close; + } This can be used just like the C method, but typically you request this object when you want to do a nonblocking style response since the writer object can be closed over or @@ -508,13 +508,13 @@ The last style of content response that L supports is setting the body like object. In this case the object is passed down to the Plack application handler directly and currently we do nothing to set encoding. - sub stream_body_fh :Local { - my ($self, $c) = @_; - my $path = File::Spec->catfile('t', 'utf8.txt'); - open(my $fh, '<', $path) || die "trouble: $!"; - $c->response->content_type('text/html'); - $c->response->body($fh); - } + sub stream_body_fh :Local { + my ($self, $c) = @_; + my $path = File::Spec->catfile('t', 'utf8.txt'); + open(my $fh, '<', $path) || die "trouble: $!"; + $c->response->content_type('text/html'); + $c->response->body($fh); + } In this example we create a filehandle to a text file that contains UTF8 encoded characters. We pass this down without modification, which I think is correct since we don't want to double @@ -546,15 +546,15 @@ content encoding header is set when we hit finalization, we skip automatic encod use utf8; sub gzipped :Local { - my ($self, $c) = @_; + my ($self, $c) = @_; - $c->res->content_type('text/plain'); - $c->res->content_type_charset('UTF-8'); - $c->res->content_encoding('gzip'); + $c->res->content_type('text/plain'); + $c->res->content_type_charset('UTF-8'); + $c->res->content_encoding('gzip'); - $c->response->body( - Compress::Zlib::memGzip( - Encode::encode_utf8("manual_1 ♥"))); + $c->response->body( + Compress::Zlib::memGzip( + Encode::encode_utf8("manual_1 ♥"))); } @@ -623,7 +623,7 @@ come after you are very clear as to your intentions. You may encounter issues with your legacy code running under default UTF8 body encoding. If so you can disable this with the following configurations setting: - MyApp->config(encoding=>undef); + MyApp->config(encoding=>undef); Where C is your L subclass. @@ -647,7 +647,7 @@ compatible hacks. Please report issues to the development team. =head1 Author -John Napiorkowski L +John Napiorkowski L =cut diff --git a/lib/Catalyst/Upgrading.pod b/lib/Catalyst/Upgrading.pod index fd5a6cc..907b309 100644 --- a/lib/Catalyst/Upgrading.pod +++ b/lib/Catalyst/Upgrading.pod @@ -147,7 +147,7 @@ look. Also we added a new develop console mode only warning when you call a component with arguments that don't expect or do anything meaningful with those args. Its -possible if you are logging debug mode in production (please don't...) this +possible if you are logging debug mode in production (please don't...) this could add verbosity to those logs if you also happen to be calling for components and passing pointless arguments. We added this warning to help people not make this error and to better understand the component resolution flow. @@ -229,7 +229,7 @@ request URL query or keywords. Most readings of the relevant specifications suggest these should be UTF-* encoded, which is the default that L will use, however if you are creating a lot of URLs manually or have external evil clients, this might cause you trouble. If you find the changes introduced -in Catalyst version 5.90080+ break some of your query code, you may disable +in Catalyst version 5.90080+ break some of your query code, you may disable the UTF-8 decoding globally using this configuration. This setting takes precedence over C and diff --git a/lib/Catalyst/Utils.pm b/lib/Catalyst/Utils.pm index 9f602f6..30ca196 100644 --- a/lib/Catalyst/Utils.pm +++ b/lib/Catalyst/Utils.pm @@ -572,7 +572,7 @@ sub inject_component { croak "Unable to build component package for \"$component_package\": $@"; Moose::Util::apply_all_roles($component_package, @{$given{traits}}) if $given{traits}; (my $file = "$component_package.pm") =~ s{::}{/}g; - $INC{$file} ||= 1; + $INC{$file} ||= 1; } my $_setup_component = sub { diff --git a/t/accept_context_regression.t b/t/accept_context_regression.t index 9828702..916281a 100644 --- a/t/accept_context_regression.t +++ b/t/accept_context_regression.t @@ -25,7 +25,7 @@ use Test::More; package MyApp; use Catalyst; - + MyApp->setup; } diff --git a/t/aggregate/catalyst_test_utf8.t b/t/aggregate/catalyst_test_utf8.t index d8eb56f..c800dfd 100644 --- a/t/aggregate/catalyst_test_utf8.t +++ b/t/aggregate/catalyst_test_utf8.t @@ -13,7 +13,7 @@ use Catalyst::Test 'TestAppEncoding'; plan skip_all => 'This test does not run live' if $ENV{CATALYST_SERVER}; -{ +{ # Test for https://rt.cpan.org/Ticket/Display.html?id=53678 # Catalyst::Test::get currently returns the raw octets, but it # would be more useful if it decoded the content based on the diff --git a/t/aggregate/live_component_controller_action_chained.t b/t/aggregate/live_component_controller_action_chained.t index f0cbc6a..d388a3b 100644 --- a/t/aggregate/live_component_controller_action_chained.t +++ b/t/aggregate/live_component_controller_action_chained.t @@ -53,7 +53,7 @@ sub run_tests { { my $expected = undef; - ok( my $response = request('http://localhost/chained/foo/1/end'), + ok( my $response = request('http://localhost/chained/foo/1/end'), 'chained + local endpoint; missing last argument' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); @@ -112,7 +112,7 @@ sub run_tests { my $expected = join( ", ", @expected ); - ok( my $response = request('http://localhost/chained/foo2/10/20/end2/15/25'), + ok( my $response = request('http://localhost/chained/foo2/10/20/end2/15/25'), 'chained + local (2 args each)' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); @@ -407,7 +407,7 @@ sub run_tests { } # - # This is for testing if the arguments got passed to the actions + # This is for testing if the arguments got passed to the actions # correctly. # { @@ -1037,8 +1037,8 @@ sub run_tests { # With args given, run "all" ok( $response = request('http://localhost/argsorder/X'), 'Correct arg order ran' ); - is( $response->header('X-Catalyst-Executed'), - join(", ", + is( $response->header('X-Catalyst-Executed'), + join(", ", qw[ TestApp::Controller::Action::Chained->begin TestApp::Controller::Action::Chained::ArgsOrder->base @@ -1047,7 +1047,7 @@ sub run_tests { ]) ); is( $response->content, 'base; ; all; X', 'Content OK' ); - + } # @@ -1088,11 +1088,11 @@ sub run_tests { is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); } - + # # */search # doc/* - # + # # request for doc/search should end up in doc/* { my @expected = qw[ diff --git a/t/aggregate/live_component_controller_action_default.t b/t/aggregate/live_component_controller_action_default.t index 6e809e7..95abd93 100644 --- a/t/aggregate/live_component_controller_action_default.t +++ b/t/aggregate/live_component_controller_action_default.t @@ -67,8 +67,8 @@ sub run_tests { ) or fail("EXCEPTION $@ DESERIALIZING " . $response->content); is_deeply( $creq->{arguments}, $expected, 'Arguments ok' ); } - - + + # Test that /foo and /foo/ both do the same thing { my @expected = qw[ @@ -76,19 +76,19 @@ sub run_tests { TestApp::Controller::Action->default TestApp::Controller::Root->end ]; - + my $expected = join( ", ", @expected ); - + ok( my $response = request('http://localhost/action'), 'Request' ); is( $response->header('X-Catalyst-Executed'), - $expected, + $expected, 'Executed actions for /action' ); - + ok( $response = request('http://localhost/action/'), 'Request' ); is( $response->header('X-Catalyst-Executed'), - $expected, + $expected, 'Executed actions for /action/' ); - } + } } diff --git a/t/aggregate/live_component_controller_action_local.t b/t/aggregate/live_component_controller_action_local.t index 052c9c1..852b11f 100644 --- a/t/aggregate/live_component_controller_action_local.t +++ b/t/aggregate/live_component_controller_action_local.t @@ -108,11 +108,11 @@ sub run_tests { } SKIP: - { + { if ( $ENV{CATALYST_SERVER} ) { skip "tests for %2F on remote server", 6; } - + ok( my $response = request('http://localhost/action/local/one/foo%2Fbar'), diff --git a/t/aggregate/live_component_controller_args.t b/t/aggregate/live_component_controller_args.t index 7b99b24..5f4364f 100644 --- a/t/aggregate/live_component_controller_args.t +++ b/t/aggregate/live_component_controller_args.t @@ -60,9 +60,9 @@ sub run_test_for { } else { $path = uri_escape($test); } - + SKIP: - { + { # Skip %2F, ., [, (, and ) tests on real webservers # Both Apache and lighttpd don't seem to like these if ( $ENV{CATALYST_SERVER} && $path =~ /(?:%2F|\.|%5B|\(|\))/ ) { @@ -85,7 +85,7 @@ sub run_test_for { if( $test =~ m{/} ) { $test =~ s{/}{}g; - $path = uri_escape( $test ); + $path = uri_escape( $test ); } ok( $response = request("http://localhost/chained/multi_cap/$path/baz"), "Requested capture for path $path"); diff --git a/t/aggregate/live_component_controller_httpmethods.t b/t/aggregate/live_component_controller_httpmethods.t index 9cc6e9f..30e16e8 100644 --- a/t/aggregate/live_component_controller_httpmethods.t +++ b/t/aggregate/live_component_controller_httpmethods.t @@ -2,7 +2,7 @@ use strict; use warnings; use Test::More; use HTTP::Request::Common qw/GET POST DELETE PUT/; - + use FindBin; use lib "$FindBin::Bin/../lib"; @@ -15,11 +15,11 @@ sub OPTIONS { is(request(GET '/httpmethods/foo')->content, 'get'); is(request(POST '/httpmethods/foo')->content, 'post'); is(request(DELETE '/httpmethods/foo')->content, 'default'); - + is(request(GET '/httpmethods/bar')->content, 'get or post'); is(request(POST '/httpmethods/bar')->content, 'get or post'); is(request(DELETE '/httpmethods/bar')->content, 'default'); - + is(request(GET '/httpmethods/baz')->content, 'any'); is(request(POST '/httpmethods/baz')->content, 'any'); is(request(DELETE '/httpmethods/baz')->content, 'any'); diff --git a/t/aggregate/live_component_controller_moose.t b/t/aggregate/live_component_controller_moose.t index 74d2fee..833861f 100644 --- a/t/aggregate/live_component_controller_moose.t +++ b/t/aggregate/live_component_controller_moose.t @@ -14,7 +14,7 @@ use Catalyst::Test 'TestApp'; } { - my $response = request('http://localhost/moose/methodmodifiers/get_attribute'); + my $response = request('http://localhost/moose/methodmodifiers/get_attribute'); ok($response->is_success); is($response->content, '42', 'parent controller method called'); is($response->header('X-Catalyst-Test-After'), 'after called', 'after works as expected'); diff --git a/t/aggregate/live_engine_request_auth.t b/t/aggregate/live_engine_request_auth.t index 77b6e7c..c7f94a5 100644 --- a/t/aggregate/live_engine_request_auth.t +++ b/t/aggregate/live_engine_request_auth.t @@ -36,6 +36,6 @@ use HTTP::Request::Common; } isa_ok( $creq, 'Catalyst::Request' ); - + is( $creq->header('Authorization'), 'Basic dGVzdDoxMjM0NQ==', 'auth header ok' ); } diff --git a/t/aggregate/live_engine_request_body_demand.t b/t/aggregate/live_engine_request_body_demand.t index 699b162..cfbeb8f 100644 --- a/t/aggregate/live_engine_request_body_demand.t +++ b/t/aggregate/live_engine_request_body_demand.t @@ -52,7 +52,7 @@ SKIP: 'Content-Type' => 'application/x-www-form-urlencoded', 'Content' => 'foo=bar&baz=quux' ); - + my $expected = { foo => 'bar', baz => 'quux', wibble => 'wobble' }; ok( my $response = request($request), 'Request' ); @@ -71,13 +71,13 @@ SKIP: # Test reading chunks of the request body using $c->read { my $creq; - + my $request = POST( 'http://localhost/body/read', 'Content-Type' => 'text/plain', 'Content' => 'x' x 105_000 ); - + my $expected = '10000|10000|10000|10000|10000|10000|10000|10000|10000|10000|5000'; ok( my $response = request($request), 'Request' ); diff --git a/t/aggregate/live_engine_request_env.t b/t/aggregate/live_engine_request_env.t index 5e7e4c6..48aa52b 100644 --- a/t/aggregate/live_engine_request_env.t +++ b/t/aggregate/live_engine_request_env.t @@ -10,7 +10,7 @@ use vars qw/ /; BEGIN { - $EXPECTED_ENV_VAR = "CATALYSTTEST$$"; # has to be uppercase otherwise fails on Win32 + $EXPECTED_ENV_VAR = "CATALYSTTEST$$"; # has to be uppercase otherwise fails on Win32 $EXPECTED_ENV_VAL = "Test env value " . rand(100000); } diff --git a/t/aggregate/live_engine_request_headers.t b/t/aggregate/live_engine_request_headers.t index 4cd98db..9913ff3 100644 --- a/t/aggregate/live_engine_request_headers.t +++ b/t/aggregate/live_engine_request_headers.t @@ -14,7 +14,7 @@ use HTTP::Request::Common; { my $creq; - my $request = GET( 'http://localhost/dump/request', + my $request = GET( 'http://localhost/dump/request', 'User-Agent' => 'MyAgen/1.0', 'X-Whats-Cool' => 'Catalyst', 'X-Multiple' => [ 1 .. 5 ], @@ -22,7 +22,7 @@ use HTTP::Request::Common; 'X-Forwarded-For' => '192.168.1.1, 1.2.3.4', 'X-Forwarded-Port' => 443 ); - + ok( my $response = request($request), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); @@ -32,7 +32,7 @@ use HTTP::Request::Common; ok( $creq->secure, 'Forwarded port sets secure' ); isa_ok( $creq->headers, 'HTTP::Headers', 'Catalyst::Request->headers' ); is( $creq->header('X-Whats-Cool'), $request->header('X-Whats-Cool'), 'Catalyst::Request->header X-Whats-Cool' ); - + { # Test that multiple headers are joined as per RFC 2616 4.2 and RFC 3875 4.1.18 my $excpected = '1, 2, 3, 4, 5'; @@ -51,7 +51,7 @@ use HTTP::Request::Common; if ( $ENV{CATALYST_SERVER} && $ENV{CATALYST_SERVER} !~ /127.0.0.1|localhost/ ) { skip "Using remote server", 2; } - + is( $creq->base->host, 'frontend.server.com', 'Catalyst::Request proxied base' ); is( $creq->address, '1.2.3.4', 'Catalyst::Request proxied address' ); } diff --git a/t/aggregate/live_engine_request_parameters.t b/t/aggregate/live_engine_request_parameters.t index d2a91f0..581fc03 100644 --- a/t/aggregate/live_engine_request_parameters.t +++ b/t/aggregate/live_engine_request_parameters.t @@ -114,7 +114,7 @@ use HTTP::Request::Common; # raw query string support { my $creq; - + my $body_parameters = { a => 1, blank => '', @@ -132,7 +132,7 @@ use HTTP::Request::Common; 'Content' => $body_parameters, 'Content-Type' => 'application/x-www-form-urlencoded' ); - + ok( my $response = request($request), 'Request' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); is( $creq->uri->query, 'query+string', 'Catalyst::Request POST query_string' ); @@ -140,7 +140,7 @@ use HTTP::Request::Common; is_deeply( $creq->query_parameters, $query_parameters, 'Catalyst::Request query_parameters' ); is_deeply( $creq->body_parameters, $body_parameters, 'Catalyst::Request body_parameters' ); is_deeply( $creq->parameters, $parameters, 'Catalyst::Request parameters' ); - + ok( $response = request('http://localhost/dump/request/a/b?x=1&y=1&z=1'), 'Request' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); is( $creq->uri->query, 'x=1&y=1&z=1', 'Catalyst::Request GET query_string' ); diff --git a/t/aggregate/live_engine_request_uploads.t b/t/aggregate/live_engine_request_uploads.t index 5ba8f18..5eb2f8c 100644 --- a/t/aggregate/live_engine_request_uploads.t +++ b/t/aggregate/live_engine_request_uploads.t @@ -158,7 +158,7 @@ use Path::Class::Dir; ok( $response->is_success, 'Response Successful 2xx' ); is( $response->content_type, 'text/plain', 'Response Content-Type' ); is( $response->content, ( $request->parts )[0]->content, 'Content' ); - + # XXX: no way to test that temporary file for this test was deleted } @@ -214,7 +214,7 @@ use Path::Class::Dir; 'Unserialize Catalyst::Request' ); } - + for my $file ( $creq->upload ) { my $upload = $creq->upload($file); SKIP: @@ -284,7 +284,7 @@ use Path::Class::Dir; is( $upload->size, length( $part->content ), 'Upload Content-Length' ); is( $upload->filename, 'catalyst_130pix.gif', 'Upload Filename' ); is( $upload->basename, 'catalyst_130pix.gif', 'Upload basename' ); - + SKIP: { if ( $ENV{CATALYST_SERVER} ) { @@ -336,7 +336,7 @@ use Path::Class::Dir; # JNAP, I added the following line in order to properly let # the $env go out of scope so that the associated tempfile # would be deleted. I think somewhere Catalyst::Test closed - # over ENV and holds state until a new command is issues but + # over ENV and holds state until a new command is issues but # I can't find it. request GET 'http://localhost/'; @@ -350,7 +350,7 @@ SKIP: if ( $ENV{CATALYST_SERVER} ) { skip 'Not testing uploadtmp on remote server', 14; } - + my $creq; my $dir = "$FindBin::Bin/"; diff --git a/t/aggregate/live_engine_request_uri.t b/t/aggregate/live_engine_request_uri.t index 5618e7c..28c8d1a 100644 --- a/t/aggregate/live_engine_request_uri.t +++ b/t/aggregate/live_engine_request_uri.t @@ -42,7 +42,7 @@ SKIP: if ( $ENV{CATALYST_SERVER} ) { skip 'Using remote server', 5; } - + local $ENV{HTTPS} = 'on'; ok( my $response = request('https://localhost/engine/request/uri'), 'HTTPS Request' ); ok( $response->is_success, 'Response Successful 2xx' ); @@ -57,7 +57,7 @@ SKIP: a => [ qw/1 2/ ], b => 3, }; - + ok( my $response = request('http://localhost/engine/request/uri?a=1;a=2;b=3'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); ok( eval '$creq = ' . $response->content, 'Unserialize Catalyst::Request' ); @@ -168,7 +168,7 @@ SKIP: if ( $ENV{CATALYST_SERVER} ) { skip 'Using remote server', 2; } - + require TestApp::RequestBaseBug; TestApp->request_class('TestApp::RequestBaseBug'); ok( my $response = request('http://localhost/engine/request/uri'), 'Request' ); diff --git a/t/aggregate/live_engine_response_large.t b/t/aggregate/live_engine_response_large.t index 05c01fc..c00ff73 100644 --- a/t/aggregate/live_engine_response_large.t +++ b/t/aggregate/live_engine_response_large.t @@ -19,7 +19,7 @@ for my $action ( keys %{$expected} ) { ok( my $response = request('http://localhost/engine/response/large/' . $action ), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); - + is( length( $response->content ), length( $expected->{$action} ), 'Length OK' ); } diff --git a/t/aggregate/live_engine_response_print.t b/t/aggregate/live_engine_response_print.t index 6c985b3..96fc5f6 100644 --- a/t/aggregate/live_engine_response_print.t +++ b/t/aggregate/live_engine_response_print.t @@ -17,6 +17,6 @@ for my $action ( sort keys %{$expected} ) { ok( my $response = request('http://localhost/engine/response/print/' . $action ), 'Request' ); ok( $response->is_success, "Response $action successful 2xx" ); - + is( $response->content, $expected->{$action}, "Content $action OK" ); } diff --git a/t/aggregate/live_priorities.t b/t/aggregate/live_priorities.t index e415827..82437e3 100644 --- a/t/aggregate/live_priorities.t +++ b/t/aggregate/live_priorities.t @@ -32,14 +32,14 @@ while ( @tests ) { my $data = shift @tests; # Run tests for path with trailing slash and without - SKIP: for my $req_uri - ( + 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 + # 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 } ) { diff --git a/t/aggregate/unit_core_uri_for_action.t b/t/aggregate/unit_core_uri_for_action.t index 6f67cca..c6c7678 100644 --- a/t/aggregate/unit_core_uri_for_action.t +++ b/t/aggregate/unit_core_uri_for_action.t @@ -83,11 +83,11 @@ my $context = TestApp->new( { # JNAP: I'm going to todo these tests, calling uri_for as a class method # should work, but its not really useful so I think theres not much harm # if someone needs this for a business case they are welcome to figure out -# what is going +# what is going TODO: { local $TODO = "Need to fix using uri_for and uri_for_action as a class method"; - + # this works, using $ctx is($context->uri_for($context->controller('Action::Chained')->action_for('endpoint')), @@ -157,10 +157,10 @@ is($context->uri_for($chained_action, [ 1 ], 2, { q => 1 }), 'uri_for_action correct for chained with multiple capturing actions and args combined' ); my $action_needs_two = '/action/chained/endpoint2'; - + ok( ! defined( $context->uri_for_action($action_needs_two, [1], (2,3)) ), 'uri_for_action returns undef for not enough captures' ); - + is( $context->uri_for_action($action_needs_two, [1,2], (2,3)), 'http://127.0.0.1/foo/chained/foo2/1/2/end2/2/3', 'uri_for_action returns correct uri for correct captures' ); @@ -171,7 +171,7 @@ is($context->uri_for($chained_action, [ 1 ], 2, { q => 1 }), ok( ! defined( $context->uri_for_action($action_needs_two, [1,2,3], (2,3)) ), 'uri_for_action returns undef for too many captures' ); - + is( $context->uri_for_action($action_needs_two, [1,2], (3)), 'http://127.0.0.1/foo/chained/foo2/1/2/end2/3', 'uri_for_action returns uri with lesser args than specified on action' ); diff --git a/t/arg_constraints.t b/t/arg_constraints.t index 95c046c..2103bf2 100644 --- a/t/arg_constraints.t +++ b/t/arg_constraints.t @@ -16,14 +16,14 @@ BEGIN { use strict; use warnings; - + use Type::Utils -all; use Types::Standard -types; use Type::Library -base, -declare => qw( UserId Heart User ContextLike ); - extends "Types::Standard"; + extends "Types::Standard"; class_type User, { class => "MyApp::Model::User::user" }; duck_type ContextLike, [qw/model/]; @@ -152,7 +152,7 @@ BEGIN { sub any_priority_link_any :Chained(link_any) PathPart('') Args(1) { $_[1]->res->body('any_priority_link_any') } sub int_priority_link_any :Chained(link_any) PathPart('') Args(Int) { $_[1]->res->body('int_priority_link_any') } - + sub link_int :Chained(chain_base) PathPart('') CaptureArgs(Int) { } sub any_priority_link :Chained(link_int) PathPart('') Args(1) { $_[1]->res->body('any_priority_link') } diff --git a/t/bad_warnings.t b/t/bad_warnings.t index e255a5c..b7bc17d 100644 --- a/t/bad_warnings.t +++ b/t/bad_warnings.t @@ -3,7 +3,7 @@ use strict; use Test::More; use HTTP::Request::Common; -# In DEBUG mode, we get not a number warnigs +# In DEBUG mode, we get not a number warnigs my $error; @@ -20,7 +20,7 @@ my $error; $c->response->body("This is the body"); } - sub infinity :Chained(root) PathPart('test') Args { + sub infinity :Chained(root) PathPart('test') Args { my ($self, $c) = @_; $c->response->body("This is the body"); Test::More::is $c->action->comparable_arg_number, ~0; diff --git a/t/class_traits.t b/t/class_traits.t index d6a0c50..1a49b33 100644 --- a/t/class_traits.t +++ b/t/class_traits.t @@ -48,11 +48,11 @@ BEGIN { sub d { 'd' } } - + { package TestApp; $INC{'TestApp.pm'} = __FILE__; - + use Catalyst; __PACKAGE__->request_class_traits([qw/TestRole Foo Bar/]); @@ -61,8 +61,8 @@ BEGIN { __PACKAGE__->setup; } - - + + foreach my $class_prefix (qw/request response stats/) { my $method = 'composed_' .$class_prefix. '_class'; ok( diff --git a/t/class_traits_CAR_bug.t b/t/class_traits_CAR_bug.t index cc57bc1..de3e6aa 100644 --- a/t/class_traits_CAR_bug.t +++ b/t/class_traits_CAR_bug.t @@ -49,18 +49,18 @@ BEGIN { } - + { package TestApp; $INC{'TestApp.pm'} = __FILE__; - + use Catalyst; __PACKAGE__->request_class_traits([qw/TestRole Foo Bar/]); __PACKAGE__->setup; } - - + + foreach my $class_prefix (qw/request/) { my $method = 'composed_' .$class_prefix. '_class'; ok( diff --git a/t/conf/extra.conf.in b/t/conf/extra.conf.in index 5445db9..48f241d 100644 --- a/t/conf/extra.conf.in +++ b/t/conf/extra.conf.in @@ -13,7 +13,7 @@ # one CGI test will fail if you don't have mod_rewrite enabled RewriteEngine on RewriteRule /cgi$ /cgi/ [PT] - + # Pass-through Authorization header for CGI/FastCGI RewriteCond %{HTTP:Authorization} ^(.+) RewriteRule ^(.*)$ $1 [E=HTTP_AUTHORIZATION:%1,PT] diff --git a/t/configured_comps.t b/t/configured_comps.t index c543c08..2c41bdb 100644 --- a/t/configured_comps.t +++ b/t/configured_comps.t @@ -9,7 +9,7 @@ use Test::More; use Moose::Role; sub role { 'role' } - + package Local::Model::Foo; use Moose; @@ -69,13 +69,13 @@ use Test::More; sub user :Local Args(1) { my ($self, $c, $int) = @_; - + Test::More::ok(my $user = $c->model("User")->find($int)); Test::More::is($c->model("User")->zoo->a, 2); Test::More::is($c->model("Foo")->role, 'role'); Test::More::is($c->model("One")->a, 'one'); Test::More::is($c->model("Two")->a, 'two'); - + $c->res->body("name: $user->{name}, age: $user->{age}"); } diff --git a/t/deprecated_appclass_action_warnings.t b/t/deprecated_appclass_action_warnings.t index f25d8d5..1e38d29 100644 --- a/t/deprecated_appclass_action_warnings.t +++ b/t/deprecated_appclass_action_warnings.t @@ -15,4 +15,4 @@ Catalyst->log($logger); ok( my $response = request('http://localhost/foo'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); -is( $DeprecatedActionsInAppClassTestApp::Log::warnings, 1, 'Get the appclass action warning' ); \ No newline at end of file +is( $DeprecatedActionsInAppClassTestApp::Log::warnings, 1, 'Get the appclass action warning' ); diff --git a/t/evil_stash.t b/t/evil_stash.t index e97a131..0354305 100644 --- a/t/evil_stash.t +++ b/t/evil_stash.t @@ -13,7 +13,7 @@ use Test::More; $c->{stash}->{foo} = 'bar'; $c->stash(baz=>'boor'); $c->{stash}->{baz} = $c->stash->{baz} . 2; - + Test::More::is($c->stash->{foo}, 'bar'); Test::More::is($c->stash->{baz}, 'boor2'); Test::More::is($c->{stash}->{foo}, 'bar'); diff --git a/t/head_middleware.t b/t/head_middleware.t index baf560a..8b8eb6d 100644 --- a/t/head_middleware.t +++ b/t/head_middleware.t @@ -43,7 +43,7 @@ test_psgi $psgi, sub { my $res = $cb->(HEAD "/root/test"); is $res->code, 200, 'OK'; is $res->content, '', 'correct body'; - is $res->content_length, 16, 'correct length'; + is $res->content_length, 16, 'correct length'; }; done_testing; diff --git a/t/http_method.t b/t/http_method.t index 797c807..039d94f 100644 --- a/t/http_method.t +++ b/t/http_method.t @@ -50,23 +50,23 @@ __END__ use Catalyst; use HTTP::Headers::ActionPack; - + my $cn = HTTP::Headers::ActionPack->new ->get_content_negotiator; - + sub Catalyst::Response::format { my $self = shift; my %formats = @_; my @formats = keys %formats; - + my $accept = $self->_context->req->header('Accept') || $format{default} || $_[0]; - + $self->headers->header('Vary' => 'Accept'); $self->headers->header('Accepts' => (join ',', @formats)); - + if(my $which = $cn->choose_media_type(\@formats, $accept)) { $self->content_type($which); if(my $possible_body = $formats{$which}->($self)) { @@ -74,7 +74,7 @@ __END__ } } else { $self->status(406); - $self->body("Method Not Acceptable"); + $self->body("Method Not Acceptable"); } } diff --git a/t/inject_component_util.t b/t/inject_component_util.t index 3ac9dcc..b015ff9 100644 --- a/t/inject_component_util.t +++ b/t/inject_component_util.t @@ -1,5 +1,5 @@ use strict; -use warnings; +use warnings; use Test::More; use FindBin; use lib "$FindBin::Bin/lib"; @@ -36,11 +36,11 @@ BEGIN { { package TestCatalyst; $INC{'TestCatalyst.pm'} = __FILE__; - + use Moose; use Catalyst; use Catalyst::Utils; - + after 'setup_components' => sub { my $self = shift; Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Model::Banana' ); @@ -50,13 +50,13 @@ BEGIN { Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Test::Apple', as => 'Apple' ); Catalyst::Utils::inject_component( into => __PACKAGE__, component => 'Test::Apple', as => 'Apple2', traits => ['RoleTest1', 'RoleTest2'] ); }; - - TestCatalyst->config( 'home' => '.' ); + + TestCatalyst->config( 'home' => '.' ); TestCatalyst->setup; } - + use Catalyst::Test qw/TestCatalyst/; - + ok( TestCatalyst->controller( $_ ) ) for qw/ Apple Test::Apple /; ok( TestCatalyst->model( $_ ) ) for qw/ Banana Cherry /; is( TestCatalyst->controller('Apple2')->aaa, 'aaa'); diff --git a/t/lib/ACLTestApp.pm b/t/lib/ACLTestApp.pm index 2b7a010..5c6aadb 100644 --- a/t/lib/ACLTestApp.pm +++ b/t/lib/ACLTestApp.pm @@ -17,8 +17,8 @@ sub execute { my ( $class, $action ) = @_; if ( Scalar::Util::blessed($action) - and $action->name ne "foobar" ) { - eval { $c->detach( 'foobar', [$action, 'foo'] ) }; + and $action->name ne "foobar" ) { + eval { $c->detach( 'foobar', [$action, 'foo'] ) }; } $c->next::method( @_ ); diff --git a/t/lib/CDICompatTestPlugin.pm b/t/lib/CDICompatTestPlugin.pm index f7e2d05..78d471a 100644 --- a/t/lib/CDICompatTestPlugin.pm +++ b/t/lib/CDICompatTestPlugin.pm @@ -8,7 +8,7 @@ package CDICompatTestPlugin; # stuff, as C::A::Plugin::Credential::Password is added to the plugin # list, and that uses base C::A::C::P class, does the mk_accessors. -# If a class data method called _config hasn't been created in +# If a class data method called _config hasn't been created in # MyApp ($app below), then our call to ->config gets our accessor # (rather than the class data one), and we fail.. @@ -26,10 +26,10 @@ sub setup { } # However, if we are too enthusiastic about adding accessors to the -# MyApp package, then this method isn't called (as there is a local +# MyApp package, then this method isn't called (as there is a local # symbol already). -# Note - use a different package here, so that Moose's +# Note - use a different package here, so that Moose's # package detection code doesn't get confused.. $CDICompatTestPlugin::Data::HAS_RUN_SETUP_FINISHED = 0; diff --git a/t/lib/Catalyst/Plugin/Test/Errors.pm b/t/lib/Catalyst/Plugin/Test/Errors.pm index 51e4873..01861b8 100644 --- a/t/lib/Catalyst/Plugin/Test/Errors.pm +++ b/t/lib/Catalyst/Plugin/Test/Errors.pm @@ -13,10 +13,10 @@ sub error { if ( $_[0] =~ /^(Unknown resource|No default action defined)/ ) { $c->response->status(404); } - + if ( $_[0] =~ /^Couldn\'t forward/ ) { $c->response->status(404); - } + } if ( $_[0] =~ /^Caught exception/ ) { $c->response->status(500); diff --git a/t/lib/Catalyst/Plugin/Test/Headers.pm b/t/lib/Catalyst/Plugin/Test/Headers.pm index 3d4feb3..f6d4690 100644 --- a/t/lib/Catalyst/Plugin/Test/Headers.pm +++ b/t/lib/Catalyst/Plugin/Test/Headers.pm @@ -10,7 +10,7 @@ sub prepare { $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 ); diff --git a/t/lib/TestApp.pm b/t/lib/TestApp.pm index c2545db..3d50a73 100644 --- a/t/lib/TestApp.pm +++ b/t/lib/TestApp.pm @@ -2,8 +2,8 @@ package TestApp; use strict; use Catalyst qw/ Test::MangleDollarUnderScore - Test::Errors - Test::Headers + Test::Errors + Test::Headers Test::Plugin Test::Inline +TestApp::Plugin::FullyQualified @@ -42,10 +42,10 @@ has 'my_greeting_obj_lazy' => ( our $VERSION = '0.01'; -TestApp->config( - name => 'TestApp', - root => '/some/dir', - use_request_uri_for_path => 1, +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 } @@ -115,9 +115,9 @@ sub execute { # 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 } ) ); } @@ -142,7 +142,7 @@ sub finalize_headers { return $c->maybe::next::method(@_); } -# Make sure we can load Inline plugins. +# Make sure we can load Inline plugins. package Catalyst::Plugin::Test::Inline; use Moose; diff --git a/t/lib/TestApp/Action/TestMatchCaptures.pm b/t/lib/TestApp/Action/TestMatchCaptures.pm index 2d9d167..be26e08 100644 --- a/t/lib/TestApp/Action/TestMatchCaptures.pm +++ b/t/lib/TestApp/Action/TestMatchCaptures.pm @@ -15,4 +15,4 @@ sub match_captures { } } -1; \ No newline at end of file +1; diff --git a/t/lib/TestApp/Controller/Action/Chained.pm b/t/lib/TestApp/Controller/Action/Chained.pm index 4c02130..2a3c779 100644 --- a/t/lib/TestApp/Controller/Action/Chained.pm +++ b/t/lib/TestApp/Controller/Action/Chained.pm @@ -191,21 +191,21 @@ sub mult_nopp2_load : Chained('mult_nopp2_base') PathPart('') Capture sub mult_nopp2_view : Chained('mult_nopp2_load') PathPart('') Args(0) { } # -# Test Choice between branches and early return logic +# Test Choice between branches and early return logic # Declaration order is important for $children->{$*}, since this is first match best. # -sub cc_base : Chained('/') PathPart('chained/choose_capture') CaptureArgs(0) { } -sub cc_link : Chained('cc_base') PathPart('') CaptureArgs(0) { } -sub cc_anchor : Chained('cc_link') PathPart('anchor.html') Args(0) { } -sub cc_all : Chained('cc_base') PathPart('') Args() { } +sub cc_base : Chained('/') PathPart('chained/choose_capture') CaptureArgs(0) { } +sub cc_link : Chained('cc_base') PathPart('') CaptureArgs(0) { } +sub cc_anchor : Chained('cc_link') PathPart('anchor.html') Args(0) { } +sub cc_all : Chained('cc_base') PathPart('') Args() { } -sub cc_a : Chained('cc_base') PathPart('') CaptureArgs(1) { } -sub cc_a_link : Chained('cc_a') PathPart('a') CaptureArgs(0) { } -sub cc_a_anchor : Chained('cc_a_link') PathPart('') Args() { } +sub cc_a : Chained('cc_base') PathPart('') CaptureArgs(1) { } +sub cc_a_link : Chained('cc_a') PathPart('a') CaptureArgs(0) { } +sub cc_a_anchor : Chained('cc_a_link') PathPart('') Args() { } -sub cc_b : Chained('cc_base') PathPart('b') CaptureArgs(0) { } -sub cc_b_link : Chained('cc_b') PathPart('') CaptureArgs(1) { } -sub cc_b_anchor : Chained('cc_b_link') PathPart('anchor.html') Args() { } +sub cc_b : Chained('cc_base') PathPart('b') CaptureArgs(0) { } +sub cc_b_link : Chained('cc_b') PathPart('') CaptureArgs(1) { } +sub cc_b_anchor : Chained('cc_b_link') PathPart('anchor.html') Args() { } # # Test static paths vs. captures diff --git a/t/lib/TestApp/Controller/Action/Chained/CaptureArgs.pm b/t/lib/TestApp/Controller/Action/Chained/CaptureArgs.pm index d42ab67..0a2783e 100644 --- a/t/lib/TestApp/Controller/Action/Chained/CaptureArgs.pm +++ b/t/lib/TestApp/Controller/Action/Chained/CaptureArgs.pm @@ -12,7 +12,7 @@ use base qw( Catalyst::Controller ); # /captureargs/*/edit # /captureargs/test/* # It will output the arguments they got passed to @_ after the -# context object. +# context object. # /captureargs/one/edit should not dispatch to /captureargs/*/* # /captureargs/test/one should not dispatch to /captureargs/*/* diff --git a/t/lib/TestApp/Controller/Engine/Request/URI.pm b/t/lib/TestApp/Controller/Engine/Request/URI.pm index 3d40780..9b30152 100644 --- a/t/lib/TestApp/Controller/Engine/Request/URI.pm +++ b/t/lib/TestApp/Controller/Engine/Request/URI.pm @@ -5,26 +5,26 @@ use base 'Catalyst::Controller'; sub default : Private { my ( $self, $c ) = @_; - + $c->forward('TestApp::View::Dump::Request'); } sub change_path : Local { my ( $self, $c ) = @_; - + # change the path $c->req->path( '/my/app/lives/here' ); - + $c->forward('TestApp::View::Dump::Request'); } sub change_base : Local { my ( $self, $c ) = @_; - + # change the base and uri paths $c->req->base->path( '/new/location' ); $c->req->uri->path( '/new/location/engine/request/uri/change_base' ); - + $c->forward('TestApp::View::Dump::Request'); } @@ -34,12 +34,12 @@ sub uri_with : Local { # change the current uri my $uri = $c->req->uri_with( { b => 1, c => undef } ); my %query = $uri->query_form; - + $c->res->header( 'X-Catalyst-Param-a' => $query{ a } ); $c->res->header( 'X-Catalyst-Param-b' => $query{ b } ); $c->res->header( 'X-Catalyst-Param-c' => exists($query{ c }) ? $query{ c } : '--notexists--' ); $c->res->header( 'X-Catalyst-query' => $uri->query); - + $c->forward('TestApp::View::Dump::Request'); } @@ -48,9 +48,9 @@ sub uri_with_object : Local { my $uri = $c->req->uri_with( { a => $c->req->base } ); my %query = $uri->query_form; - + $c->res->header( 'X-Catalyst-Param-a' => $query{ a } ); - + $c->forward('TestApp::View::Dump::Request'); } @@ -59,9 +59,9 @@ sub uri_with_utf8 : Local { # change the current uri my $uri = $c->req->uri_with( { unicode => "\x{2620}" } ); - + $c->res->header( 'X-Catalyst-uri-with' => "$uri" ); - + $c->forward('TestApp::View::Dump::Request'); } @@ -73,9 +73,9 @@ sub uri_with_undef : Local { # change the current uri my $uri = $c->req->uri_with( { foo => undef } ); - + $c->res->header( 'X-Catalyst-warnings' => $warnings ); - + $c->forward('TestApp::View::Dump::Request'); } @@ -83,7 +83,7 @@ sub uri_with_undef_only : Local { my ( $self, $c ) = @_; my $uri = $c->req->uri_with( { a => undef } ); - + $c->res->header( 'X-Catalyst-uri-with' => "$uri" ); $c->forward('TestApp::View::Dump::Request'); } @@ -92,7 +92,7 @@ sub uri_with_undef_ignore : Local { my ( $self, $c ) = @_; my $uri = $c->req->uri_with( { a => 1, b => undef } ); - + my %query = $uri->query_form; $c->res->header( 'X-Catalyst-uri-with' => "$uri" ); $c->res->header( 'X-Catalyst-Param-a' => $query{ a } ); diff --git a/t/lib/TestApp/Controller/Engine/Response/Large.pm b/t/lib/TestApp/Controller/Engine/Response/Large.pm index 75d4ef3..b49222d 100644 --- a/t/lib/TestApp/Controller/Engine/Response/Large.pm +++ b/t/lib/TestApp/Controller/Engine/Response/Large.pm @@ -5,7 +5,7 @@ use base 'Catalyst::Controller'; sub one : Relative { my ( $self, $c ) = @_; - $c->res->output( 'x' x (100 * 1024) ); + $c->res->output( 'x' x (100 * 1024) ); } sub two : Relative { diff --git a/t/lib/TestApp/Controller/Engine/Response/Print.pm b/t/lib/TestApp/Controller/Engine/Response/Print.pm index 13f3d04..7fc719f 100644 --- a/t/lib/TestApp/Controller/Engine/Response/Print.pm +++ b/t/lib/TestApp/Controller/Engine/Response/Print.pm @@ -5,7 +5,7 @@ use base 'Catalyst::Controller'; sub one :Relative { my ( $self, $c ) = @_; - + $c->res->print("foo"); } diff --git a/t/lib/TestApp/Controller/Fork.pm b/t/lib/TestApp/Controller/Fork.pm index 2645e6e..5690efa 100644 --- a/t/lib/TestApp/Controller/Fork.pm +++ b/t/lib/TestApp/Controller/Fork.pm @@ -1,4 +1,4 @@ -# Fork.pm +# Fork.pm # Copyright (c) 2006 Jonathan Rockway package TestApp::Controller::Fork; @@ -13,22 +13,22 @@ sub system : Local { my ($self, $c, $ls) = @_; my ($result, $code) = (undef, 1); - if(!-e $ls || !-x _){ + if(!-e $ls || !-x _){ $result = 'skip'; } else { $result = system($ls, $ls, $ls); $result = $! if $result != 0; } - + $c->response->body(encode_json({result => $result})); } sub backticks : Local { my ($self, $c, $ls) = @_; my ($result, $code) = (undef, 1); - - if(!-e $ls || !-x _){ + + if(!-e $ls || !-x _){ $result = 'skip'; $code = 0; } @@ -36,7 +36,7 @@ sub backticks : Local { $result = `$ls $ls $ls` || $!; $code = $?; } - + $c->response->body(encode_json({result => $result, code => $code})); } @@ -44,7 +44,7 @@ sub fork : Local { my ($self, $c) = @_; my $pid; my $x = 0; - + if($pid = fork()){ $x = "ok"; } @@ -53,7 +53,7 @@ sub fork : Local { } waitpid $pid,0 or die; - + $c->response->body(encode_json({pid => $pid, result => $x})); } diff --git a/t/lib/TestApp/Controller/HTTPMethods.pm b/t/lib/TestApp/Controller/HTTPMethods.pm index 5d42858..b784775 100644 --- a/t/lib/TestApp/Controller/HTTPMethods.pm +++ b/t/lib/TestApp/Controller/HTTPMethods.pm @@ -2,29 +2,29 @@ package TestApp::Controller::HTTPMethods; use Moose; use MooseX::MethodAttributes; - + extends 'Catalyst::Controller'; - + sub default : Path Args { my ($self, $ctx) = @_; $ctx->response->body('default'); } - + sub get : Path('foo') Method('GET') { my ($self, $ctx) = @_; $ctx->response->body('get'); } - + sub post : Path('foo') Method('POST') { my ($self, $ctx) = @_; $ctx->response->body('post'); } - + sub get_or_post : Path('bar') Method('GET') Method('POST') { my ($self, $ctx) = @_; $ctx->response->body('get or post'); } - + sub any_method : Path('baz') { my ($self, $ctx) = @_; $ctx->response->body('any'); @@ -63,7 +63,7 @@ sub get_or_put :Chained('base') PathPart('get_put_post_delete') CaptureArgs(0) G sub get2 :Chained('get_or_put') PathPart('') Args(0) GET { pop->res->body('get2'); } - + sub put2 :Chained('get_or_put') PathPart('') Args(0) PUT { pop->res->body('put2'); } @@ -73,7 +73,7 @@ sub post_or_delete :Chained('base') PathPart('get_put_post_delete') CaptureArgs( sub post2 :Chained('post_or_delete') PathPart('') Args(0) POST { pop->res->body('post2'); } - + sub delete2 :Chained('post_or_delete') PathPart('') Args(0) DELETE { pop->res->body('delete2'); } diff --git a/t/lib/TestApp/Model/ClosuresInConfig.pm b/t/lib/TestApp/Model/ClosuresInConfig.pm index 8f005b4..224f509 100644 --- a/t/lib/TestApp/Model/ClosuresInConfig.pm +++ b/t/lib/TestApp/Model/ClosuresInConfig.pm @@ -5,7 +5,7 @@ use namespace::clean -except => 'meta'; extends 'TestApp::Model'; # Note - don't call ->config in here until the constructor calls it to -# retrieve config, so that we get the 'copy from parent' path, +# retrieve config, so that we get the 'copy from parent' path, # and ergo break due to the closure if dclone is used there.. __PACKAGE__->meta->make_immutable; diff --git a/t/lib/TestApp/Role.pm b/t/lib/TestApp/Role.pm index af02a21..46f0e9c 100644 --- a/t/lib/TestApp/Role.pm +++ b/t/lib/TestApp/Role.pm @@ -9,7 +9,7 @@ our $SETUP_DISPATCHER = 0; before 'setup_finalize' => sub { $SETUP_FINALIZE++ }; -before 'setup_dispatcher' => sub { $SETUP_DISPATCHER++ }; +before 'setup_dispatcher' => sub { $SETUP_DISPATCHER++ }; 1; diff --git a/t/lib/TestApp2/Controller/Root.pm b/t/lib/TestApp2/Controller/Root.pm index 0fefe63..e40ee8c 100644 --- a/t/lib/TestApp2/Controller/Root.pm +++ b/t/lib/TestApp2/Controller/Root.pm @@ -8,7 +8,7 @@ __PACKAGE__->config(namespace => q{}); use base 'Catalyst::Controller'; # your actions replace this one -sub main :Path('') { +sub main :Path('') { $_[1]->res->body('

It works

'); $_[1]->res->content_type('text/html'); } diff --git a/t/lib/TestAppChainedAbsolutePathPart.pm b/t/lib/TestAppChainedAbsolutePathPart.pm index 6ffd047..3c62aef 100644 --- a/t/lib/TestAppChainedAbsolutePathPart.pm +++ b/t/lib/TestAppChainedAbsolutePathPart.pm @@ -2,15 +2,15 @@ package TestAppChainedAbsolutePathPart; use strict; use Catalyst qw/ - Test::Errors - Test::Headers + Test::Errors + Test::Headers /; use Catalyst::Utils; our $VERSION = '0.01'; TestAppChainedAbsolutePathPart - ->config( + ->config( name => 'TestAppChainedAbsolutePathPart', root => '/some/dir' ); diff --git a/t/lib/TestAppChainedRecursive.pm b/t/lib/TestAppChainedRecursive.pm index 7d28cab..03f798a 100644 --- a/t/lib/TestAppChainedRecursive.pm +++ b/t/lib/TestAppChainedRecursive.pm @@ -2,8 +2,8 @@ package TestAppChainedRecursive; use strict; use Catalyst qw/ - Test::Errors - Test::Headers + Test::Errors + Test::Headers /; use Catalyst::Utils; diff --git a/t/lib/TestAppEncoding/Controller/Root.pm b/t/lib/TestAppEncoding/Controller/Root.pm index 1c42bfa..72296ad 100644 --- a/t/lib/TestAppEncoding/Controller/Root.pm +++ b/t/lib/TestAppEncoding/Controller/Root.pm @@ -10,8 +10,8 @@ sub binary : Local { my ($self, $c) = @_; $c->res->content_type('image/gif'); $c->res->body(do { - open(my $fh, '<', $c->path_to('..', '..', 'catalyst_130pix.gif')) or die $!; - binmode($fh); + open(my $fh, '<', $c->path_to('..', '..', 'catalyst_130pix.gif')) or die $!; + binmode($fh); local $/ = undef; <$fh>; }); } @@ -29,7 +29,7 @@ sub binary_utf8 : Local { sub utf8_non_ascii_content : Local { use utf8; my ($self, $c) = @_; - + my $str = 'ʇsʎlɐʇɐɔ'; # 'catalyst' flipped at http://www.revfad.com/flip.html ok utf8::is_utf8($str), '$str is in UTF8 internally'; diff --git a/t/lib/TestAppOnDemand.pm b/t/lib/TestAppOnDemand.pm index 6704a8a..259941f 100644 --- a/t/lib/TestAppOnDemand.pm +++ b/t/lib/TestAppOnDemand.pm @@ -2,8 +2,8 @@ package TestAppOnDemand; use strict; use Catalyst qw/ - Test::Errors - Test::Headers + Test::Errors + Test::Headers /; use Catalyst::Utils; diff --git a/t/lib/TestAppOnDemand/Controller/Body.pm b/t/lib/TestAppOnDemand/Controller/Body.pm index bbf3c88..4ee9e0f 100644 --- a/t/lib/TestAppOnDemand/Controller/Body.pm +++ b/t/lib/TestAppOnDemand/Controller/Body.pm @@ -25,16 +25,16 @@ sub params : Local { sub read : Local { my ( $self, $c ) = @_; - + # read some data my @chunks; - + while ( my $data = $c->read( 10_000 ) ) { push @chunks, $data; } $c->res->content_type( 'text/plain'); - + $c->res->body( join ( '|', map { length $_ } @chunks ) ); } diff --git a/t/lib/TestAppUnicode/Controller/Root.pm b/t/lib/TestAppUnicode/Controller/Root.pm index a944b95..f693486 100644 --- a/t/lib/TestAppUnicode/Controller/Root.pm +++ b/t/lib/TestAppUnicode/Controller/Root.pm @@ -7,7 +7,7 @@ __PACKAGE__->config(namespace => q{}); use base 'Catalyst::Controller'; -sub main :Path('') { +sub main :Path('') { my ($self, $ctx, $charset) = @_; my $content_type = 'text/html'; if ($ctx->stash->{charset}) { diff --git a/t/lib/TestContentNegotiation/Controller/Root.pm b/t/lib/TestContentNegotiation/Controller/Root.pm index 60fe6f7..68a41b6 100644 --- a/t/lib/TestContentNegotiation/Controller/Root.pm +++ b/t/lib/TestContentNegotiation/Controller/Root.pm @@ -10,7 +10,7 @@ sub start :Chained(/) PathPrefix CaptureArgs(0) { } sub is_json : Chained('start') PathPart('') Consumes('application/json') Args(0) { pop->res->body('is_json1') } sub is_urlencoded : Chained('start') PathPart('') Consumes('application/x-www-form-urlencoded') Args(0) { pop->res->body('is_urlencoded1') } sub is_multipart : Chained('start') PathPart('') Consumes('multipart/form-data') Args(0) { pop->res->body('is_multipart1') } - + sub under :Chained('start') CaptureArgs(0) { } sub is_json_under : Chained('under') PathPart('') Consumes(JSON) Args(0) { pop->res->body('is_json2') } @@ -18,11 +18,11 @@ sub start :Chained(/) PathPrefix CaptureArgs(0) { } sub is_multipart_under : Chained('under') PathPart('') Consumes(Multipart) Args(0) { pop->res->body('is_multipart2') } ## Or allow more than one type - + sub multi :Chained('start') PathPart('') CaptureArgs(0) { } - + sub is_more_than_one_1 - : Chained('multi') + : Chained('multi') : Consumes('application/x-www-form-urlencoded') : Consumes('multipart/form-data') : Args(0) @@ -31,7 +31,7 @@ sub start :Chained(/) PathPrefix CaptureArgs(0) { } } sub is_more_than_one_2 - : Chained('multi') + : Chained('multi') : Consumes('HTMLForm') : Args(0) { @@ -39,7 +39,7 @@ sub start :Chained(/) PathPrefix CaptureArgs(0) { } } sub is_more_than_one_3 - : Chained('multi') + : Chained('multi') : Consumes('application/x-www-form-urlencoded,multipart/form-data') : Args(0) { diff --git a/t/lib/TestContentNegotiation/share/file.txt b/t/lib/TestContentNegotiation/share/file.txt index ab8e0eb..4c9f6cf 100644 --- a/t/lib/TestContentNegotiation/share/file.txt +++ b/t/lib/TestContentNegotiation/share/file.txt @@ -10,7 +10,7 @@ sub start :Chained(/) PathPrefix CaptureArgs(0) { } sub is_json : Chained('start') PathPart('') Consumes('application/json') Args(0) { pop->res->body('is_json') } sub is_urlencoded : Chained('start') PathPart('') Consumes('application/x-www-form-urlencoded') Args(0) { pop->res->body('is_urlencoded') } sub is_multipart : Chained('start') PathPart('') Consumes('multipart/form-data') Args(0) { pop->res->body('is_multipart') } - + sub under :Chained('start') CaptureArgs(0) { } sub is_json_under : Chained('under') PathPart('') Consumes(JSON) Args(0) { pop->res->body('is_json') } @@ -18,9 +18,9 @@ sub start :Chained(/) PathPrefix CaptureArgs(0) { } sub is_multipart_under : Chained('under') PathPart('') Consumes(Multipart) Args(0) { pop->res->body('is_multipart') } ## Or allow more than one type - + sub multi :Chained('start') CaptureArgs(0) { } - + sub is_more_than_one_1 : Chained('multi') PathPart('') : Consumes('application/x-www-form-urlencoded') diff --git a/t/live_catalyst_test.t b/t/live_catalyst_test.t index 8248527..2589ae5 100644 --- a/t/live_catalyst_test.t +++ b/t/live_catalyst_test.t @@ -46,12 +46,12 @@ my $req = '/dump/request'; } { - my $response = request( POST( '/bodyparams', { override => 'this' } ) )->content; + my $response = request( POST( '/bodyparams', { override => 'this' } ) )->content; is($response, 'that', 'body param overridden'); } { - my $response = request( POST( '/bodyparams/no_params' ) )->content; + my $response = request( POST( '/bodyparams/no_params' ) )->content; is($response, 'HASH', 'empty body param is hashref'); } diff --git a/t/optional_lighttpd-fastcgi-non-root.t b/t/optional_lighttpd-fastcgi-non-root.t index 1a59e29..80600f9 100644 --- a/t/optional_lighttpd-fastcgi-non-root.t +++ b/t/optional_lighttpd-fastcgi-non-root.t @@ -69,7 +69,7 @@ server.bind = "127.0.0.1" server.port = $port # Work around inability to hit http://localhost/deep/path -# without a trailing slash +# without a trailing slash url.rewrite = ( "deep/path\$" => "deep/path/" ) # catalyst app specific fcgi setup @@ -90,14 +90,14 @@ fastcgi.server = ( ) END -open(my $lightconf, '>', "$docroot/lighttpd.conf") +open(my $lightconf, '>', "$docroot/lighttpd.conf") or die "Can't open $docroot/lighttpd.conf: $!"; print {$lightconf} $conf or die "Write error: $!"; close $lightconf; -my $pid = open my $lighttpd, "$lighttpd_bin -D -f $docroot/lighttpd.conf 2>&1 |" +my $pid = open my $lighttpd, "$lighttpd_bin -D -f $docroot/lighttpd.conf 2>&1 |" or die "Unable to spawn lighttpd: $!"; - + # wait for it to start while ( check_port( 'localhost', $port ) != 1 ) { diag "Waiting for server to start..."; diff --git a/t/optional_lighttpd-fastcgi.t b/t/optional_lighttpd-fastcgi.t index 07a5828..fefa06a 100644 --- a/t/optional_lighttpd-fastcgi.t +++ b/t/optional_lighttpd-fastcgi.t @@ -85,14 +85,14 @@ fastcgi.server = ( ) END -open(my $lightconf, '>', "$docroot/lighttpd.conf") +open(my $lightconf, '>', "$docroot/lighttpd.conf") or die "Can't open $docroot/lighttpd.conf: $!"; print {$lightconf} $conf or die "Write error: $!"; close $lightconf; -my $pid = open my $lighttpd, "$lighttpd_bin -D -f $docroot/lighttpd.conf 2>&1 |" +my $pid = open my $lighttpd, "$lighttpd_bin -D -f $docroot/lighttpd.conf 2>&1 |" or die "Unable to spawn lighttpd: $!"; - + # wait for it to start while ( check_port( 'localhost', $port ) != 1 ) { diag "Waiting for server to start..."; diff --git a/t/optional_memleak.t b/t/optional_memleak.t index 59e388c..499c365 100644 --- a/t/optional_memleak.t +++ b/t/optional_memleak.t @@ -17,7 +17,7 @@ plan skip_all => 'Proc::ProcessTable required for this test' if $@; use JSON::MaybeXS qw(decode_json); our $t = Proc::ProcessTable->new( cache_ttys => 1 ); -our ( $initial, $final ) = ( 0, 0 ); +our ( $initial, $final ) = ( 0, 0 ); my $test_data = do { open my $fh, '<:raw', "$FindBin::Bin/optional_stress.json" or die "$!"; local $/; @@ -38,7 +38,7 @@ if ( $user_test ) { else { map { $total_tests += scalar @{ $tests->{$_} } } keys %{$tests}; plan tests => $total_tests; - + foreach my $test_group ( keys %{$tests} ) { foreach my $test ( @{ $tests->{$test_group} } ) { run_test( $test ); @@ -48,40 +48,40 @@ else { sub run_test { my $uri = shift || die 'No URI given for test'; - + print "TESTING $uri\n"; - + # make a few requests to set initial memory size for ( 1 .. 3 ) { request( $uri ); } - + $initial = size_of($$); print "Initial Size: $initial\n"; - + for ( 1 .. 500 ) { request( $uri ); } - + $final = size_of($$); print "Final Size: $final\n"; - + if ( $final > $initial ) { print "Leaked: " . ($final - $initial) . "K\n"; } - + is( $final, $initial, "'$uri' memory is not leaking" ); } sub size_of { my $pid = shift; - + foreach my $p ( @{ $t->table } ) { if ( $p->pid == $pid ) { return $p->rss; } } - + die "Pid $pid not found?"; } diff --git a/t/optional_threads.t b/t/optional_threads.t index c45e66e..b0a05c9 100644 --- a/t/optional_threads.t +++ b/t/optional_threads.t @@ -26,12 +26,12 @@ else { plan skip_all => 'Needs a Perl with ithreads enabled'; } } - + no warnings 'redefine'; sub request { - my $thr = threads->new( + my $thr = threads->new( sub { Catalyst::Test::local_request('TestApp',@_) }, - @_ + @_ ); $thr->join; } @@ -46,7 +46,7 @@ sub request { ]; my $expected = join( ", ", @expected ); - + ok( my $response = request('http://localhost/action/default'), 'Request' ); ok( $response->is_success, 'Response Successful 2xx' ); is( $response->header('X-Catalyst-Executed'), $expected, 'Executed actions' ); diff --git a/t/path_action_empty_brackets.t b/t/path_action_empty_brackets.t index 5d100d5..2e499bf 100644 --- a/t/path_action_empty_brackets.t +++ b/t/path_action_empty_brackets.t @@ -27,4 +27,4 @@ use Catalyst::Test 'TestPath'; ok( my $response = request('http://localhost/four'), 'Request' ); ok( $response->is_success, '"Path(\'\')" - Response Successful 2xx' ); is( $response->content, 'OK', '"Path() Args()" - Body okay' ); -} \ No newline at end of file +} diff --git a/t/psgi_utils.t b/t/psgi_utils.t index eb69e9d..6508886 100644 --- a/t/psgi_utils.t +++ b/t/psgi_utils.t @@ -122,7 +122,7 @@ my $psgi_app = sub { $c->res->body("$uri"); } - + sub get_env { my ($self, $c) = @_; if($c->req->query_parameters->{path_prefix}) { @@ -255,7 +255,7 @@ use Catalyst::Test 'MyApp'; # END [/user/local_example_args1/***/] -# BEGIN [/user/path-example] +# BEGIN [/user/path-example] { my ($res, $c) = ctx_request('/user/path-example'); diff --git a/t/query_constraints.t b/t/query_constraints.t index 81e3e1d..5d93d2b 100644 --- a/t/query_constraints.t +++ b/t/query_constraints.t @@ -16,14 +16,14 @@ BEGIN { use strict; use warnings; - + use Type::Utils -all; use Types::Standard -types; use Type::Library -base, -declare => qw( UserId Heart ); - extends "Types::Standard"; + extends "Types::Standard"; declare UserId, as Int, @@ -59,7 +59,7 @@ BEGIN { } sub string_types :Local Query(q=>'Str',age=>'Int') { pop->res->body('string_type') } - + sub as_ref :Local Query(Dict[age=>Int,sex=>Enum['f','m','o'], slurpy HashRef[Int]]) { pop->res->body('as_ref') } sub utf8 :Local Query(utf8=>Heart) { pop->res->body("heart") } @@ -68,7 +68,7 @@ BEGIN { sub big :Chained(chain) PathPart('') Args(0) Query(size=>Int,...) { pop->res->body('big') } sub small :Chained(chain) PathPart('') Args(0) Query(size=>UserId,...) { pop->res->body('small') } - + sub default :Default { my ($self, $c, $int) = @_; $c->res->body('default'); diff --git a/t/query_keywords_and_parameters.t b/t/query_keywords_and_parameters.t index 27e598b..6801cf0 100644 --- a/t/query_keywords_and_parameters.t +++ b/t/query_keywords_and_parameters.t @@ -25,7 +25,7 @@ use Catalyst::Test 'MyApp'; # These tests assume that the decoding that occurs for the query string follows # the payload decoding algorithm described here: -# https://www.w3.org/TR/html5/forms.html#url-encoded-form-data +# https://www.w3.org/TR/html5/forms.html#url-encoded-form-data { ok my $req = GET 'root/bar'; diff --git a/t/unicode-exception-bug.t b/t/unicode-exception-bug.t index 14031b0..f25836f 100644 --- a/t/unicode-exception-bug.t +++ b/t/unicode-exception-bug.t @@ -40,11 +40,11 @@ BEGIN { TestApp::Controller::Root->config(namespace => ''); } - + { package TestApp; $INC{'TestApp.pm'} = __FILE__; - + use Catalyst; use TestApp::Exception; @@ -56,8 +56,8 @@ BEGIN { __PACKAGE__->setup; } - - + + use Catalyst::Test 'TestApp'; { @@ -65,7 +65,7 @@ use Catalyst::Test 'TestApp'; is ($res->status_line, "200 OK"); is ($res->content, '

OK

'); } - + { my $res = request('/%E2%C3%83%C6%92%C3%8'); is ($res->content, 'Bad unicode data'); diff --git a/t/unicode-exception-return-value.t b/t/unicode-exception-return-value.t index 3f52a2a..8a6817c 100644 --- a/t/unicode-exception-return-value.t +++ b/t/unicode-exception-return-value.t @@ -31,7 +31,7 @@ BEGIN { { package TestApp; $INC{'TestApp.pm'} = __FILE__; - + use Catalyst; sub handle_unicode_encoding_exception { @@ -44,15 +44,15 @@ BEGIN { __PACKAGE__->setup; } - - + + use Catalyst::Test 'TestApp'; { my $res = request('/ok'); is ($res->content, "ok\n", "app is echoing arguments"); } - + { my $res = request('/%E2%C3%83%C6%92%C3%8'); is ($res->content, "INVALID-UNICODE\n", diff --git a/t/unit_utils_load_class.t b/t/unit_utils_load_class.t index 510d9c1..c2535d2 100644 --- a/t/unit_utils_load_class.t +++ b/t/unit_utils_load_class.t @@ -59,7 +59,7 @@ is( $@, "foo", '$@ is untouched' ); undef $@; eval { Catalyst::Utils::ensure_class_loaded("This::Module::Is::Not::In::Inc::But::Does::Exist") }; -ok( !$@, "no error when loading non existent .pm that *does* have a symbol table entry" ); +ok( !$@, "no error when loading non existent .pm that *does* have a symbol table entry" ); undef $@; eval { Catalyst::Utils::ensure_class_loaded('Silly::File::.#Name') }; diff --git a/t/useless_set_headers.t b/t/useless_set_headers.t index 0db6fda..78873fb 100644 --- a/t/useless_set_headers.t +++ b/t/useless_set_headers.t @@ -13,7 +13,7 @@ use HTTP::Request::Common; sub my_warnings { $warn[0] }; sub warn { shift; push(@warn, @_) } - + package MyApp::Controller::Root; $INC{'MyApp/Controller/Root.pm'} = __FILE__; diff --git a/t/utf_incoming.t b/t/utf_incoming.t index 5293951..9b2b68e 100644 --- a/t/utf_incoming.t +++ b/t/utf_incoming.t @@ -10,7 +10,7 @@ use JSON::MaybeXS; use Data::Dumper; use Scalar::Util (); -# Test cases for incoming utf8 +# Test cases for incoming utf8 { package MyApp::Controller::Root; @@ -73,7 +73,7 @@ use Scalar::Util (); # Test to make sure redirect can now take an object (sorry don't have a better place for it # but wanted test coverage. my $location = $c->res->redirect( $c->uri_for($c->controller('Root')->action_for('uri_for')) ); - Test::More::ok !ref $location; + Test::More::ok !ref $location; } sub stream_write :Local { @@ -170,7 +170,7 @@ use Scalar::Util (); # Encode JSON also encodes to a UTF-8 encoded, binary string. This is why we don't # have application/json as one of the things we match, otherwise we get double - # encoding. + # encoding. $c->response->body(JSON::MaybeXS::encode_json($post)); }