| 1 | package CatalystX::ActionRole::Negotiate; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Moose::Role; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Path::Class; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use HTTP::Negotiate; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 2 | with 'Role::MimeInfo'; | |||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | CatalystX::ActionRole::Negotiate - ActionRole for content negotiation | ||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||
| 19 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | Version 0.05 | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | 2 | our $VERSION = '0.05'; | |||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | sub default :Path :Does('+CatalystX::ActionRole::Negotiate') { | ||||||||||||||||||||||||||||||||||||||||||
| 30 | my ($self, $c, @args) = @_; | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | # tell it to use args rather than $c->req->path | ||||||||||||||||||||||||||||||||||||||||||
| 33 | $c->stash->{negotiate_use_args} = 1; | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | # obtain variants (if you care) | ||||||||||||||||||||||||||||||||||||||||||
| 36 | my @variants = @{$c->stash->{variants}}; | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | # maybe manipulate them? i dunno | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | # set them back, or set entirely new ones | ||||||||||||||||||||||||||||||||||||||||||
| 41 | $c->stash->{variants} = \@variants; | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | # action role negotiates variants and returns the winner | ||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | This module serves content-negotiated static content from the document | ||||||||||||||||||||||||||||||||||||||||||
| 49 | root. It also affords mixing dynamic variants in with static variants, | ||||||||||||||||||||||||||||||||||||||||||
| 50 | the list of which is passed directly into the | ||||||||||||||||||||||||||||||||||||||||||
| 51 | L<HTTP::Negotiate/choose> function. The winning variant is chosen from | ||||||||||||||||||||||||||||||||||||||||||
| 52 | the various C<Accept-*> request headers. | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | As with Apache and other Web servers, dimensions for static variants | ||||||||||||||||||||||||||||||||||||||||||
| 55 | are derived from file extensions. Currently the only supported | ||||||||||||||||||||||||||||||||||||||||||
| 56 | dimension is MIME content type. | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | There is a slight difference in the behaviour between this module and | ||||||||||||||||||||||||||||||||||||||||||
| 59 | Apache: whereas there is one or more files of the form C<foo.*> | ||||||||||||||||||||||||||||||||||||||||||
| 60 | alongside a directory called C<foo> containing one or more files with | ||||||||||||||||||||||||||||||||||||||||||
| 61 | the slug C<index>, these will all be lumped into the set of variants. | ||||||||||||||||||||||||||||||||||||||||||
| 62 | The customary trailing slash, however, will only be applied in the | ||||||||||||||||||||||||||||||||||||||||||
| 63 | case that a C<foo/index.*> file is chosen over a C<foo.*> file. This | ||||||||||||||||||||||||||||||||||||||||||
| 64 | is different from Apache in that the latter ignores C<foo.*> files if | ||||||||||||||||||||||||||||||||||||||||||
| 65 | there is also a directory present called C<foo>. The purpose of this | ||||||||||||||||||||||||||||||||||||||||||
| 66 | change is to provide an easy way to style URIs I<without> the trailing | ||||||||||||||||||||||||||||||||||||||||||
| 67 | slash while still providing for descendants along the same URI path. | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | Interacting with the action in a handler goes as follows: | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | =item 1. | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | The action runs and first attempts to collect any eligible static | ||||||||||||||||||||||||||||||||||||||||||
| 76 | variants found by concatenating the request-URI to the document root. | ||||||||||||||||||||||||||||||||||||||||||
| 77 | It puts what it finds in C<< $c->stash->{variants} >>. To indicate the | ||||||||||||||||||||||||||||||||||||||||||
| 78 | indeterminate state of the response to the caller, the status is | ||||||||||||||||||||||||||||||||||||||||||
| 79 | initially set to 404. | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | =item 2. | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | The action runs the calling handler, offering it an opportunity to | ||||||||||||||||||||||||||||||||||||||||||
| 84 | manipulate the variant list or intercede in the response. | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | =item 3. | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | If the handler has not changed the response code to a value below 400, | ||||||||||||||||||||||||||||||||||||||||||
| 89 | the action proceeds to select a variant and set the appropriate headers. | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | =item 4. | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | The action performs a trailing-slash check to match the request-URI to | ||||||||||||||||||||||||||||||||||||||||||
| 94 | the internal representation, redirecting if necessary with a code 301. | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | =item 5. | ||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | An C<If-Modified-Since> check is performed, which will return 304 if | ||||||||||||||||||||||||||||||||||||||||||
| 99 | the client already has the latest version of the document. | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | =item 6. | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | If the action has not terminated the response by now, it sets the | ||||||||||||||||||||||||||||||||||||||||||
| 104 | response body to the variant and the status to 200. If you need to, | ||||||||||||||||||||||||||||||||||||||||||
| 105 | you can still manipulate it in a subsequent (e.g. C<end>) handler. | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | The calling controller action is sandwiched between the | ||||||||||||||||||||||||||||||||||||||||||
| 110 | variant-generating operation and the variant-selecting operation. It | ||||||||||||||||||||||||||||||||||||||||||
| 111 | is placed as an C<ARRAY> reference for your convenience in | ||||||||||||||||||||||||||||||||||||||||||
| 112 | C<< $c->stash->{variants} >>. This structure is exactly the same as | ||||||||||||||||||||||||||||||||||||||||||
| 113 | that which is passed into L<HTTP::Negotiate>, save for these | ||||||||||||||||||||||||||||||||||||||||||
| 114 | exceptions: | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | =item 1. | ||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | Variants do not need to be a string identifier, but in fact can be | ||||||||||||||||||||||||||||||||||||||||||
| 121 | anything that can be consumed by a view or middleware component, e.g., | ||||||||||||||||||||||||||||||||||||||||||
| 122 | a file handle or any other kind of supported object. | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | =item 2. | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | L<Path::Class::File> objects get special treatment, as they are what | ||||||||||||||||||||||||||||||||||||||||||
| 127 | the initial static variant list is made out of. | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | =item 3. | ||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | Append an additional integer to the end of a variant's record to | ||||||||||||||||||||||||||||||||||||||||||
| 132 | supply an artificial C<Last-Modified> value as a UNIX time stamp. | ||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | Otherwise, consult L<HTTP::Negotiate> for how to construct the | ||||||||||||||||||||||||||||||||||||||||||
| 137 | records. This modification enables you to mix static variants in with | ||||||||||||||||||||||||||||||||||||||||||
| 138 | dynamic ones, or overwrite the list with purely dynamic variants. | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | =head CAVEATS | ||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | Note that this module may conflict with L<Catalyst::Plugin::Static::Simple>. | ||||||||||||||||||||||||||||||||||||||||||
| 143 | In future releases I will attempt to bring this module up to par so | ||||||||||||||||||||||||||||||||||||||||||
| 144 | that it can be a viable replacement, or at the very least be a better | ||||||||||||||||||||||||||||||||||||||||||
| 145 | cohabitant. | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | 2 | ▶ | before execute => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=23 SCAR=38.2
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 152 | 2 | my ($ctl, $c, @args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||
| 154 | 2 | my $req = $c->req; | |||||||||||||||||||||||||||||||||||||||||
| 155 | 2 | my $resp = $c->res; | |||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | 2 | $resp->status(404); | |||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | 2 | my $root = Path::Class::Dir->new($c->config->{root}); | |||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 2 | my @ps; | |||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | # XXX flip this later maybe | ||||||||||||||||||||||||||||||||||||||||||
| 164 | 2 | ▶ | if ($c->stash->{negotiate_use_args}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | @ps = @args; | |||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||
| 167 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 168 | # get a clean URI path. (unfortunately Path::Class doesn't get it | ||||||||||||||||||||||||||||||||||||||||||
| 169 | # this clean) | ||||||||||||||||||||||||||||||||||||||||||
| 170 | 2 | @ps = map { (/^([^;]*)(?:;.*)?$/) } split m!/+!, $req->path; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 2 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||
| 172 | 2 | ▶ | while ($i < @ps) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 2 | ▶ | if ($ps[$i] eq '' or $ps[$i] eq '.') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$ps[$i] eq "" or $ps[$i] eq "."
MC/DC0%0/2
$ps[$i] eq "" or $ps[$i] eq "."
$ps[$i] eq ""
$ps[$i] eq "."
Truth table33%1/3
A or B
A= $ps[$i] eq ""B= $ps[$i] eq "."
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | splice @ps, $i, 1; | |||||||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||||||||
| 176 | elsif ($ps[$i] eq '..') { | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | $i > 0 ? splice @ps, $i-1, 2 : splice @ps, $i, 1; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 180 | 2 | $i++; | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | 2 | $c->log->debug('Negotiate: trying ' . $root->file(@ps)); | |||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | # if the path terminates with a slash, what does it mean? | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | # * the path is a legitimate directory /foo/ which should be | ||||||||||||||||||||||||||||||||||||||||||
| 190 | # forwarded internally to /foo/index | ||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | # * the client (probably robot) is appending a trailing slash to | ||||||||||||||||||||||||||||||||||||||||||
| 193 | # /foo which ordinarily wouldn't have one. | ||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | # ok, so how do we want it to behave? | ||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | # if @ps is length 0, then we are looking at the root URI, so | ||||||||||||||||||||||||||||||||||||||||||
| 198 | # append 'index' and start looking for variants. | ||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | # if @ps is any longer than 0, then we are looking at something | ||||||||||||||||||||||||||||||||||||||||||
| 201 | # beneath the root. | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | # if there is a trailing slash in the request, we want to do an | ||||||||||||||||||||||||||||||||||||||||||
| 204 | # exact match on the dir(/index) first, then exact match for | ||||||||||||||||||||||||||||||||||||||||||
| 205 | # files, then fuzzy match on the files. if no trailing slash, then | ||||||||||||||||||||||||||||||||||||||||||
| 206 | # exact match on files first, then fuzzy match on files, then | ||||||||||||||||||||||||||||||||||||||||||
| 207 | # dir(/index). this is different from mod_negotiate. | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | # if there is a trailing slash on the request and what was found | ||||||||||||||||||||||||||||||||||||||||||
| 210 | # was a file, 301 to a url with no trailing slash. similarly, if | ||||||||||||||||||||||||||||||||||||||||||
| 211 | # the request had no trailing slash and what was found was a dir, | ||||||||||||||||||||||||||||||||||||||||||
| 212 | # 301 to a url with a trailing slash. | ||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | my $slash = $c->stash->{negotiate_use_args} ? undef : | ||||||||||||||||||||||||||||||||||||||||||
| 215 | 2 | ▶ | $req->path =~ m!/(?:;[^/]*)?$!; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | 2 | my $dpath = $root->file(@ps, 'index'); | |||||||||||||||||||||||||||||||||||||||||
| 217 | 2 | my $fpath = $root->file(@ps); | |||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | 2 | ▶ | my @indices = grep { $_ and my $x = $_->stat; $x and -f $x } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$x && -f $x
MC/DC0%0/2
$x && -f $x
$x
-f $x
Truth table33%1/3
A && B
A= $xB= -f $x
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | 2 | ▶ | map { Path::Class::File->new($_) } glob(quotemeta($dpath) . "{,.*}"); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 8 | ▶ | my @files = grep { $_ and my $x = $_->stat; $x and -f $x } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$x && -f $x
MC/DC50%1/2
$x && -f $x
$x
-f $x
Truth table66%2/3
A && B
A= $xB= -f $x
| |||||||||||||||||||||||||||||||||||||||||||
| 223 | 2 | ▶ | ($fpath, map { Path::Class::File->new($_) } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | glob(quotemeta($fpath) . "{,.*}")) if @ps > 0; | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | # XXX we needed to switch the order of operations around a bit, | ||||||||||||||||||||||||||||||||||||||||||
| 227 | # otherwise this stashed stuff will never get assigned | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | # gin up some maps so we can figure out where the chosen variant | ||||||||||||||||||||||||||||||||||||||||||
| 230 | # came from | ||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | my %i = map { $_->stringify => $_ } @indices; | |||||||||||||||||||||||||||||||||||||||||
| 232 | 2 | my %f = map { $_->stringify => $_ } @files; | |||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | # stash goodies | ||||||||||||||||||||||||||||||||||||||||||
| 235 | 2 | my $pkg = __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||
| 236 | 2 | ▶ | $pkg = $c->stash->{$pkg} ||= {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$c->stash->{$pkg} ||= {}
MC/DC0%0/1
$c->stash->{$pkg} ||= {}
$c->stash->{$pkg}
Truth table50%1/2
A
A= $c->stash->{$pkg}
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 2 | $pkg->{ps} = \@ps; | |||||||||||||||||||||||||||||||||||||||||
| 238 | 2 | $pkg->{slash} = $slash; | |||||||||||||||||||||||||||||||||||||||||
| 239 | 2 | $pkg->{files} = \%f; | |||||||||||||||||||||||||||||||||||||||||
| 240 | 2 | $pkg->{indices} = \%i; | |||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | # if these arrays are both empty then this is a 404 | ||||||||||||||||||||||||||||||||||||||||||
| 243 | 2 | ▶ | unless (@indices + @files > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | $resp->status(404); | |||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | $resp->body("Not found (not for a lack of looking)."); | |||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | # now construct variant list | ||||||||||||||||||||||||||||||||||||||||||
| 250 | 2 | my @variants; | |||||||||||||||||||||||||||||||||||||||||
| 251 | 2 | for my $v (@indices, @files) { | |||||||||||||||||||||||||||||||||||||||||
| 252 | 4 | my $vs = $v->stringify; | |||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | # we do the thing with the slash through the QS parameter | ||||||||||||||||||||||||||||||||||||||||||
| 255 | 4 | my $qs = 1; | |||||||||||||||||||||||||||||||||||||||||
| 256 | 4 | ▶ | if ($slash) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | if ($vs eq $fpath->stringify) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | $qs = 0.75; | |||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 260 | elsif ($f{$vs}) { | ||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | $qs = 0.5; | |||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||
| 263 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | $qs = 1; | |||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||
| 266 | } | ||||||||||||||||||||||||||||||||||||||||||
| 267 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 268 | 4 | ▶ | if ($vs eq $fpath->stringify) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | $qs = 1; | |||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||
| 271 | elsif ($i{$vs}) { | ||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | $qs = 0.5; | |||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||
| 274 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 4 | $qs = 0.75; | |||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | 4 | ▶ | my $st = $v->stat or next; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 280 | 4 | my ($size, $mtime) = ($st->size, $st->mtime); | |||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | # we still include the variant if it isn't readable, because | ||||||||||||||||||||||||||||||||||||||||||
| 283 | # that's how we will deliver a 403 rather than a 404 | ||||||||||||||||||||||||||||||||||||||||||
| 284 | 4 | ▶ | $qs /= 100.0 unless -r $st; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||||||||||||||
| 286 | # note mtime does not get touched by HTTP::Negotiate; indeed | ||||||||||||||||||||||||||||||||||||||||||
| 287 | # it gets stripped off with the return value | ||||||||||||||||||||||||||||||||||||||||||
| 288 | 4 | push @variants, [$v, $qs, $self->mimetype($v->resolve->stringify), | |||||||||||||||||||||||||||||||||||||||||
| 289 | undef, undef, undef, $st->size, $st->mtime ]; | ||||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | # assign variants to stash | ||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||
| 294 | 2 | $c->stash->{variants} = \@variants; | |||||||||||||||||||||||||||||||||||||||||
| 295 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 2 | ▶ | after execute => sub { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=29 SCAR=42.5
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 299 | 2 | my ($ctl, $c) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 300 | 2 | my $req = $c->req; | |||||||||||||||||||||||||||||||||||||||||
| 301 | 2 | my $resp = $c->res; | |||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | 2 | ▶ | return if $resp->status < 400; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | 2 | my $pkg = __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||
| 306 | 2 | $pkg = $c->stash->{$pkg}; | |||||||||||||||||||||||||||||||||||||||||
| 307 | 2 | my @ps = @{$pkg->{ps}}; | |||||||||||||||||||||||||||||||||||||||||
| 308 | 2 | my $slash = $pkg->{slash}; | |||||||||||||||||||||||||||||||||||||||||
| 309 | 2 | my %f = %{$pkg->{files}}; | |||||||||||||||||||||||||||||||||||||||||
| 310 | 2 | my %i = %{$pkg->{indices}}; | |||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | # overwrite whatever came back from the caller | ||||||||||||||||||||||||||||||||||||||||||
| 313 | 2 | my %valt; | |||||||||||||||||||||||||||||||||||||||||
| 314 | 2 | my @variants = do { | |||||||||||||||||||||||||||||||||||||||||
| 315 | 2 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | 4 | map { my $k = sprintf '%08x', $i++; $valt{$k} = $_; | |||||||||||||||||||||||||||||||||||||||||
| 318 | 2 | ▶ | [$k, @{$_}[1..$#{$_}]] } @{$c->stash->{variants} || []}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$c->stash->{'variants'} || []
MC/DC0%0/1
$c->stash->{'variants'} || []
$c->stash->{'variants'}
Truth table50%1/2
A
A= $c->stash->{'variants'}
| |||||||||||||||||||||||||||||||||||||||||||
| 319 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | # now we check again | ||||||||||||||||||||||||||||||||||||||||||
| 322 | 2 | ▶ | unless (@variants > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | $resp->status(404); | |||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | $resp->body('Not found (no variant)'); | |||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | # add */* because for some reason the content negotiator won't | ||||||||||||||||||||||||||||||||||||||||||
| 329 | # select if not in there (hi chrome) | ||||||||||||||||||||||||||||||||||||||||||
| 330 | 2 | my $hdr = $req->headers; | |||||||||||||||||||||||||||||||||||||||||
| 331 | 2 | ▶ | my $acc = $hdr->header('Accept') || ''; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$hdr->header('Accept') || ''
MC/DC100%1/1
$hdr->header('Accept') || ''
$hdr->header('Accept')
Truth table100%2/2
A
A= $hdr->header('Accept')
| |||||||||||||||||||||||||||||||||||||||||||
| 332 | 2 | $c->log->debug('Negotiate: Testing variants against Accept: ' . $acc); | |||||||||||||||||||||||||||||||||||||||||
| 333 | 2 | ▶ | $hdr->push_header(Accept => '*/*;q=0.5') unless $acc and $acc =~ m!\*/\*!; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$acc and $acc =~ m[\*/\*]
MC/DC50%1/2
$acc and $acc =~ m[\*/\*]
$acc
$acc =~ m[\*/\*]
Truth table66%2/3
A and B
A= $accB= $acc =~ m[\*/\*]
| |||||||||||||||||||||||||||||||||||||||||||
| 334 | # perform the negotiation | ||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | 2 | my $chosen = HTTP::Negotiate::choose(\@variants, $hdr); | |||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||
| 339 | 2 | ▶ | unless ($chosen) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 340 | 1 | $resp->status(406); | |||||||||||||||||||||||||||||||||||||||||
| 341 | 1 | $resp->body('No Suitable Type'); | |||||||||||||||||||||||||||||||||||||||||
| 342 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | # retrieve actual variant | ||||||||||||||||||||||||||||||||||||||||||
| 346 | 1 | ▶ | unless ($chosen = $valt{$chosen}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | $resp->status(500); | |||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | $resp->body('Cannot find metainformation for chosen variant'); | |||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||
| 352 | 1 | my ($body, $qs, $type, $encoding, $charset, $lang, $size, $mtime) = | |||||||||||||||||||||||||||||||||||||||||
| 353 | @$chosen; | ||||||||||||||||||||||||||||||||||||||||||
| 354 | |||||||||||||||||||||||||||||||||||||||||||
| 355 | # now we check that slash again | ||||||||||||||||||||||||||||||||||||||||||
| 356 | 1 | my $uri = $req->uri->clone->canonical; | |||||||||||||||||||||||||||||||||||||||||
| 357 | 1 | $uri->path('/'); | |||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 1 | ▶ | if (Scalar::Util::blessed($body) && $body->isa('Path::Class::File')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
builtin::blessed($body) and $body->isa("Path::Class::File")
MC/DC0%0/2
builtin::blessed($body) and $body->isa("Path::Class::File")
builtin::blessed($body)
$body->isa("Path::Class::File")
Truth table33%1/3
A and B
A= builtin::blessed($body)B= $body->isa("Path::Class::File")
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | # this will happen if the best variant was an unreadable one | ||||||||||||||||||||||||||||||||||||||||||
| 362 | 1 | my $cstat = $body->stat; | |||||||||||||||||||||||||||||||||||||||||
| 363 | 1 | ▶ | unless (-r $cstat) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | $c->res->status(403); | |||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | $c->res->body("Forbidden"); | |||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | 1 | ▶ | $size ||= $cstat->size; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$size ||= $cstat->size
MC/DC0%0/2
$size ||= $cstat->size
$size
$cstat->size
Truth table33%1/3
A ||= B
A= $sizeB= $cstat->size
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 1 | ▶ | $mtime ||= $cstat->mtime; | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$mtime ||= $cstat->mtime
MC/DC0%0/2
$mtime ||= $cstat->mtime
$mtime
$cstat->mtime
Truth table33%1/3
A ||= B
A= $mtimeB= $cstat->mtime
| |||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||
| 372 | 1 | ▶ | if ($slash and $f{$chosen}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$slash and $f{$chosen}
MC/DC0%0/2
$slash and $f{$chosen}
$slash
$f{$chosen}
Truth table33%1/3
A and B
A= $slashB= $f{$chosen}
| |||||||||||||||||||||||||||||||||||||||||||
| 373 | # remove the slash and redirect | ||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | $uri->path_segments('', @ps); | |||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | $c->log->debug("Negotiate: Removed slash from $uri"); | |||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | $c->res->redirect($uri, 301) unless $uri->eq($req->uri); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||
| 378 | ▶ | elsif (!$slash and $i{$chosen}) { | |||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
not $slash and $i{$chosen}
MC/DC0%0/2
not $slash and $i{$chosen}
not $slash
$i{$chosen}
Truth table33%1/3
not(A) and B
A= not $slashB= $i{$chosen}
| |||||||||||||||||||||||||||||||||||||||||||
| 379 | # add the slash and redirect | ||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | $uri->path_segments('', @ps, ''); | |||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | $c->log->debug("Negotiate: Added slash to $uri"); | |||||||||||||||||||||||||||||||||||||||||
| 382 | 0 | ▶ | $c->res->redirect($uri, 301) unless $uri->eq($req->uri); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||
| 384 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 385 | #noop | ||||||||||||||||||||||||||||||||||||||||||
| 386 | 1 | $c->log->debug('Negotiate: No URI path to fix'); | |||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | # replace body with reference to body | ||||||||||||||||||||||||||||||||||||||||||
| 390 | 1 | $body = $body->openr; | |||||||||||||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | 1 | my $rhdr = $resp->headers; | |||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||
| 395 | 1 | ▶ | if ($type) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 396 | 1 | ▶ | $type .= ";charset=$charset" if $charset; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | 1 | $c->log->debug("Negotiate: setting content type to $type"); | |||||||||||||||||||||||||||||||||||||||||
| 398 | 1 | $rhdr->content_type($type); | |||||||||||||||||||||||||||||||||||||||||
| 399 | } | ||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||
| 401 | 1 | ▶ | $rhdr->header('Content-Encoding' => $encoding) if $encoding; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | 1 | ▶ | $rhdr->header('Content-Language' => $lang) if $lang; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | 1 | ▶ | if ($mtime) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 1 | $rhdr->last_modified($mtime); | |||||||||||||||||||||||||||||||||||||||||
| 406 | 1 | my $ims = $req->headers->if_modified_since; | |||||||||||||||||||||||||||||||||||||||||
| 407 | 1 | ▶ | if ($ims and $mtime and $ims >= $mtime) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$ims and $mtime and $ims >= $mtime
$ims and $mtime
MC/DC0%0/3
$ims and $mtime and $ims >= $mtime
$ims
$mtime
$ims >= $mtime
Truth table25%1/4
A and B and C
A= $imsB= $mtimeC= $ims >= $mtime
| |||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | $c->log->debug('Negotiate: ' . $req->uri . ' not modified'); | |||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | $resp->status(304); | |||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 411 | } | ||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | # set this *after* we test for 304 | ||||||||||||||||||||||||||||||||||||||||||
| 415 | 1 | ▶ | $rhdr->content_length($size) if defined $size; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | # assume something downstream knows what to do with this | ||||||||||||||||||||||||||||||||||||||||||
| 418 | 1 | $resp->status(200); | |||||||||||||||||||||||||||||||||||||||||
| 419 | 1 | $resp->body($body); | |||||||||||||||||||||||||||||||||||||||||
| 420 | 2 | }; | |||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||
| 422 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||
| 424 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||
| 426 | =item | ||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||
| 428 | L<Catalyst::Action> | ||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | =item | ||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||
| 432 | L<HTTP::Negotiate> | ||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | =item | ||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||
| 436 | L<Role::MimeInfo> | ||||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||
| 442 | Dorian Taylor, C<< <dorian at cpan.org> >> | ||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||
| 444 | =head1 BUGS | ||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||
| 446 | Please report bugs | ||||||||||||||||||||||||||||||||||||||||||
| 447 | L<on GitHub|https://github.com/doriantaylor/p5-catalystx-action-negotiate/issues>. | ||||||||||||||||||||||||||||||||||||||||||
| 448 | |||||||||||||||||||||||||||||||||||||||||||
| 449 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||
| 451 | You can find documentation for this module with the perldoc command. | ||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | perldoc CatalystX::Action::Negotiate | ||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||
| 455 | You can also look for information at: | ||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||
| 459 | =item * MetaCPAN | ||||||||||||||||||||||||||||||||||||||||||
| 460 | |||||||||||||||||||||||||||||||||||||||||||
| 461 | L<http://metacpan.org/release/CatalystX-Action-Negotiate/> | ||||||||||||||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||||||||||||||
| 463 | =item * The source | ||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||
| 465 | L<https://github.com/doriantaylor/p5-catalystx-action-negotiate> | ||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||
| 469 | =head1 LICENSE AND COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||
| 470 | |||||||||||||||||||||||||||||||||||||||||||
| 471 | Copyright 2019 Dorian Taylor. | ||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||
| 473 | Licensed under the Apache License, Version 2.0 (the "License"); you | ||||||||||||||||||||||||||||||||||||||||||
| 474 | may not use this file except in compliance with the License. You may | ||||||||||||||||||||||||||||||||||||||||||
| 475 | obtain a copy of the License at | ||||||||||||||||||||||||||||||||||||||||||
| 476 | L<http://www.apache.org/licenses/LICENSE-2.0>. | ||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||
| 478 | Unless required by applicable law or agreed to in writing, software | ||||||||||||||||||||||||||||||||||||||||||
| 479 | distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||||||||||||||||||||||||||||||||
| 480 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | ||||||||||||||||||||||||||||||||||||||||||
| 481 | implied. See the License for the specific language governing | ||||||||||||||||||||||||||||||||||||||||||
| 482 | permissions and limitations under the License. | ||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||
| 484 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||
| 486 | 2 | 1; # End of CatalystX::ActionRole::Negotiate | |||||||||||||||||||||||||||||||||||||||||