| 1 | package Web::Request::Types; | ||||||||||
| 2 | 26 | our $AUTHORITY = 'cpan:PTC'; | |||||||||
| 3 | 26 | $Web::Request::Types::VERSION = '0.12'; | |||||||||
| 4 | 26 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 26 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | # ABSTRACT: package defining subtypes for this distribution | ||||||||||
| 7 | |||||||||||
| 8 | 26 | ▶ | use Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 26 | class_type('HTTP::Headers'); | |||||||||
| 11 | |||||||||||
| 12 | subtype 'Web::Request::Types::StringLike', | ||||||||||
| 13 | as 'Object', | ||||||||||
| 14 | 2 | ▶ | where { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
| |||||||||||
| 15 | 2 | ▶ | return unless overload::Method($_, '""'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 2 | my $tc = find_type_constraint('Web::Request::Types::PSGIBodyObject'); | |||||||||
| 17 | 2 | return !$tc->check($_); | |||||||||
| 18 | 26 | }; | |||||||||
| 19 | |||||||||||
| 20 | 26 | duck_type 'Web::Request::Types::PSGIBodyObject' => ['getline', 'close']; | |||||||||
| 21 | |||||||||||
| 22 | 26 | subtype 'Web::Request::Types::PSGIBody', | |||||||||
| 23 | as 'ArrayRef[Str|Web::Request::Types::StringLike]|FileHandle|Web::Request::Types::PSGIBodyObject'; | ||||||||||
| 24 | |||||||||||
| 25 | subtype 'Web::Request::Types::HTTPStatus', | ||||||||||
| 26 | as 'Int', | ||||||||||
| 27 | 44 | ▶ | where { /^[1-5][0-9][0-9]$/ }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 28 | |||||||||||
| 29 | 26 | subtype 'Web::Request::Types::HTTP::Headers', | |||||||||
| 30 | as 'HTTP::Headers'; | ||||||||||
| 31 | coerce 'Web::Request::Types::HTTP::Headers', | ||||||||||
| 32 | from 'ArrayRef', | ||||||||||
| 33 | 2 | ▶ | via { HTTP::Headers->new(@$_) }, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 34 | from 'HashRef', | ||||||||||
| 35 | 13 | ▶ | via { HTTP::Headers->new(%$_) }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 36 | |||||||||||
| 37 | coerce 'Web::Request::Types::PSGIBody', | ||||||||||
| 38 | from 'Str|Web::Request::Types::StringLike', | ||||||||||
| 39 | 18 | ▶ | via { [ $_ ] }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 40 | |||||||||||
| 41 | 26 | 1; | |||||||||
| 42 | |||||||||||
| 43 | __END__ | ||||||||||