| 1 | # ---------------------------------------------------------------------------------------------------------------------- | ||||||||||
| 2 | # GX Framework (c) 2009-2011 Jörg A. Uzarek <uzarek@runlevelnull.de> | ||||||||||
| 3 | # File: GX/Response.pm | ||||||||||
| 4 | # ---------------------------------------------------------------------------------------------------------------------- | ||||||||||
| 5 | |||||||||||
| 6 | package GX::Response; | ||||||||||
| 7 | |||||||||||
| 8 | 4 | ▶ | use GX::HTTP::Response::Cookies; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | |||||||||||
| 11 | # ---------------------------------------------------------------------------------------------------------------------- | ||||||||||
| 12 | # Class setup | ||||||||||
| 13 | # ---------------------------------------------------------------------------------------------------------------------- | ||||||||||
| 14 | |||||||||||
| 15 | 4 | ▶ | use GX::Class; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | 4 | extends qw( GX::Component GX::HTTP::Response ); | |||||||||
| 18 | |||||||||||
| 19 | 4 | has 'cookies' => ( | |||||||||
| 20 | isa => 'Scalar', | ||||||||||
| 21 | initializer => '_initialize_cookies' | ||||||||||
| 22 | ); | ||||||||||
| 23 | |||||||||||
| 24 | 4 | build; | |||||||||
| 25 | |||||||||||
| 26 | |||||||||||
| 27 | # ---------------------------------------------------------------------------------------------------------------------- | ||||||||||
| 28 | # Export mechanism | ||||||||||
| 29 | # ---------------------------------------------------------------------------------------------------------------------- | ||||||||||
| 30 | |||||||||||
| 31 | 4 | __PACKAGE__->_install_import_method; | |||||||||
| 32 | |||||||||||
| 33 | |||||||||||
| 34 | # ---------------------------------------------------------------------------------------------------------------------- | ||||||||||
| 35 | # Public methods | ||||||||||
| 36 | # ---------------------------------------------------------------------------------------------------------------------- | ||||||||||
| 37 | |||||||||||
| 38 | 0 | ▶ | sub cookie { | ||||||||
|
Subroutine
cookie: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 39 | |||||||||||
| 40 | 0 | return shift->cookies->get( @_ ); | |||||||||
| 41 | |||||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 0 | ▶ | sub has_body { | ||||||||
|
Subroutine
has_body: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 45 | |||||||||||
| 46 | 0 | ▶ | return $_[0]->body->length ? 1 : 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | |||||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | 0 | ▶ | sub has_cookies { | ||||||||
|
Subroutine
has_cookies: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 51 | |||||||||||
| 52 | 0 | ▶ | return $_[0]->cookies->count ? 1 : 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | |||||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 0 | ▶ | sub has_headers { | ||||||||
|
Subroutine
has_headers: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 57 | |||||||||||
| 58 | 0 | ▶ | return $_[0]->headers->count ? 1 : 0; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 59 | |||||||||||
| 60 | } | ||||||||||
| 61 | |||||||||||
| 62 | |||||||||||
| 63 | # ---------------------------------------------------------------------------------------------------------------------- | ||||||||||
| 64 | # Private methods | ||||||||||
| 65 | # ---------------------------------------------------------------------------------------------------------------------- | ||||||||||
| 66 | |||||||||||
| 67 | 4 | ▶ | sub _initialize_cookies { | ||||||||
|
Subroutine
_initialize_cookies: called CC=1 SCAR=0.0
| |||||||||||
| 68 | |||||||||||
| 69 | 4 | return GX::HTTP::Response::Cookies->new; | |||||||||
| 70 | |||||||||||
| 71 | } | ||||||||||
| 72 | |||||||||||
| 73 | 2 | ▶ | sub _validate_class_name { | ||||||||
|
Subroutine
_validate_class_name: called CC=1 SCAR=0.0
| |||||||||||
| 74 | |||||||||||
| 75 | 2 | return $_[1] =~ /^(?:[_a-zA-Z]\w*::)+Response$/; | |||||||||
| 76 | |||||||||||
| 77 | } | ||||||||||
| 78 | |||||||||||
| 79 | |||||||||||
| 80 | 4 | 1; | |||||||||
| 81 | |||||||||||
| 82 | __END__ | ||||||||||