| 1 | package Web::Request::Types; | ||||||||||
| 2 | BEGIN { | ||||||||||
| 3 | 26 | ▶ | $Web::Request::Types::AUTHORITY = 'cpan:DOY'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | } | ||||||||||
| 5 | { | ||||||||||
| 6 | 26 | $Web::Request::Types::VERSION = '0.11'; | |||||||||
| 7 | } | ||||||||||
| 8 | 26 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 26 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 26 | ▶ | use Moose::Util::TypeConstraints; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | |||||||||||
| 13 | 26 | class_type('HTTP::Headers'); | |||||||||
| 14 | |||||||||||
| 15 | subtype 'Web::Request::Types::StringLike', | ||||||||||
| 16 | as 'Object', | ||||||||||
| 17 | where { | ||||||||||
| 18 | 2 | ▶ | return unless overload::Method($_, '""'); | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.1
Branch: 1 branch
| |||||||||||
| 19 | 2 | my $tc = find_type_constraint('Web::Request::Types::PSGIBodyObject'); | |||||||||
| 20 | 2 | return !$tc->check($_); | |||||||||
| 21 | 26 | }; | |||||||||
| 22 | |||||||||||
| 23 | 26 | duck_type 'Web::Request::Types::PSGIBodyObject' => ['getline', 'close']; | |||||||||
| 24 | |||||||||||
| 25 | 26 | subtype 'Web::Request::Types::PSGIBody', | |||||||||
| 26 | as 'ArrayRef[Str|Web::Request::Types::StringLike]|FileHandle|Web::Request::Types::PSGIBodyObject'; | ||||||||||
| 27 | |||||||||||
| 28 | subtype 'Web::Request::Types::HTTPStatus', | ||||||||||
| 29 | as 'Int', | ||||||||||
| 30 | 44 | ▶ | where { /^[1-5][0-9][0-9]$/ }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 31 | |||||||||||
| 32 | 26 | subtype 'Web::Request::Types::HTTP::Headers', | |||||||||
| 33 | as 'HTTP::Headers'; | ||||||||||
| 34 | coerce 'Web::Request::Types::HTTP::Headers', | ||||||||||
| 35 | from 'ArrayRef', | ||||||||||
| 36 | 2 | ▶ | via { HTTP::Headers->new(@$_) }, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 37 | from 'HashRef', | ||||||||||
| 38 | 13 | ▶ | via { HTTP::Headers->new(%$_) }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 39 | |||||||||||
| 40 | coerce 'Web::Request::Types::PSGIBody', | ||||||||||
| 41 | from 'Str|Web::Request::Types::StringLike', | ||||||||||
| 42 | 18 | ▶ | via { [ $_ ] }; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 43 | |||||||||||
| 44 | 26 | 1; | |||||||||
| 45 | |||||||||||
| 46 | __END__ | ||||||||||
| 47 | |||||||||||
| 48 | =pod | ||||||||||
| 49 | |||||||||||
| 50 | =head1 NAME | ||||||||||
| 51 | |||||||||||
| 52 | Web::Request::Types | ||||||||||
| 53 | |||||||||||
| 54 | =head1 VERSION | ||||||||||
| 55 | |||||||||||
| 56 | version 0.11 | ||||||||||
| 57 | |||||||||||
| 58 | =head1 AUTHOR | ||||||||||
| 59 | |||||||||||
| 60 | Jesse Luehrs <doy@tozt.net> | ||||||||||
| 61 | |||||||||||
| 62 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 63 | |||||||||||
| 64 | This software is copyright (c) 2013 by Jesse Luehrs. | ||||||||||
| 65 | |||||||||||
| 66 | This is free software; you can redistribute it and/or modify it under | ||||||||||
| 67 | the same terms as the Perl 5 programming language system itself. | ||||||||||
| 68 | |||||||||||
| 69 | =cut | ||||||||||