Commit d5e6d99
committed
Handle multi-line sub attributes
For use with Catalyst::Plugin::CheckFileUploadTypes, I needed to provide
a fairly long list of acceptable MIME types. This means that my handler
code would be e.g.:
```perl
sub index_POST: ExpectUploads(image/png image/jpeg application/pdf) {
...
}
```
... which is fine, but the list of types to support grew longer and
longer, not helped by some very long MIME types such as
`application/vnd.openxmlformats-officedocument.wordprocessingml.document`
So, I wanted to make it much more readable, for e.g.:
```perl
sub index_POST: ExpectUploads(
image/jpeg image/png image/bmp
application/pdf
application/vnd.openxmlformats-officedocument.wordprocessingml.document
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
) {
...
}
```
That looks like it should be fine, but failed, because the code in
`Catalyst::Controller::_parse_attrs()` which parse subroutine attributes
expected it to be all on line line.
This change makes it work correctly for me, both for single-line
attributes with and without a value and for multi-lined ones as per the
example above too - and makes the parsing code a little more readable
too, I think.1 parent 7c1f15f commit d5e6d99
1 file changed
+12
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
400 | 400 | | |
401 | 401 | | |
402 | 402 | | |
403 | | - | |
404 | 403 | | |
405 | | - | |
406 | | - | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
407 | 414 | | |
408 | 415 | | |
409 | 416 | | |
410 | | - | |
| 417 | + | |
| 418 | + | |
411 | 419 | | |
412 | 420 | | |
413 | 421 | | |
| |||
0 commit comments