| 1 | package OpenInteract2::Response; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # $Id: Response.pm,v 1.28 2005/03/17 14:57:58 sjn Exp $ | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 87 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 87 | ▶ | use base qw( Class::Factory Class::Accessor::Fast ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 87 | ▶ | use HTTP::Status qw( RC_FOUND ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 87 | ▶ | use Log::Log4perl qw( get_logger ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 87 | ▶ | use OpenInteract2::Constants qw( :log ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 87 | ▶ | use OpenInteract2::Context qw( CTX DEPLOY_URL ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 87 | ▶ | use OpenInteract2::Exception qw( oi_error ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 87 | $OpenInteract2::Response::VERSION = sprintf("%d.%02d", q$Revision: 1.28 $ =~ /(\d+)\.(\d+)/); | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 87 | my ( $log ); | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | ######################################## | ||||||||||||||||||||||||||||
| 18 | # ACCESSORS | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | # TODO: 'error_hold' is temporary, until we get the error reporting | ||||||||||||||||||||||||||||
| 21 | # back to the template worked out | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 87 | my @FIELDS = qw( | |||||||||||||||||||||||||||
| 24 | status controller send_file send_filehandle content charset | ||||||||||||||||||||||||||||
| 25 | ); | ||||||||||||||||||||||||||||
| 26 | 87 | __PACKAGE__->mk_accessors( @FIELDS, 'error_hold' ); | |||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 87 | my ( $RESPONSE_TYPE, $RESPONSE_CLASS ); | |||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sub set_implementation_type { | ||||||||||||||||||||||||||
|
Subroutine
set_implementation_type: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 31 | 0 | my ( $class, $type ) = @_; | |||||||||||||||||||||||||||
| 32 | 0 | my $impl_class = eval { $class->get_factory_class( $type ) }; | |||||||||||||||||||||||||||
| 33 | 0 | ▶ | oi_error $@ if ( $@ ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 34 | 0 | $RESPONSE_TYPE = $type; | |||||||||||||||||||||||||||
| 35 | 0 | $RESPONSE_CLASS = $impl_class; | |||||||||||||||||||||||||||
| 36 | 0 | return $impl_class; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 0 | ▶ | sub get_implementation_type { | ||||||||||||||||||||||||||
|
Subroutine
get_implementation_type: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 40 | 0 | return $RESPONSE_TYPE; | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 44 | 0 | my ( $class, @params ) = @_; | |||||||||||||||||||||||||||
| 45 | 0 | ▶ | $log ||= get_logger( LOG_RESPONSE ); | ||||||||||||||||||||||||||
|
Condition0%0/3
$log ||= get_logger("OI2.RESPONSE")
MC/DC0%0/2
$log ||= get_logger("OI2.RESPONSE")
$log
get_logger("OI2.RESPONSE")
Truth table0%0/3
A ||= B
A= $logB= get_logger("OI2.RESPONSE")
| |||||||||||||||||||||||||||||
| 46 | 0 | ▶ | unless ( $RESPONSE_CLASS ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | 0 | $log->fatal( "No response implementation type set" ); | |||||||||||||||||||||||||||
| 48 | 0 | oi_error 'Before creating an OpenInteract2::Response object you ', | |||||||||||||||||||||||||||
| 49 | 'must set the request type with "set_implementation_type()"'; | ||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | 0 | my $self = bless( { _cookie => {}, | |||||||||||||||||||||||||||
| 52 | _header => {} }, $RESPONSE_CLASS ); | ||||||||||||||||||||||||||||
| 53 | 0 | $self->init( @params ); | |||||||||||||||||||||||||||
| 54 | 0 | CTX->response( $self ); | |||||||||||||||||||||||||||
| 55 | 0 | return $self; | |||||||||||||||||||||||||||
| 56 | } | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | ######################################## | ||||||||||||||||||||||||||||
| 59 | # HEADERS | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | # header shortcuts | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | 0 | ▶ | sub content_type { | ||||||||||||||||||||||||||
|
Subroutine
content_type: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 64 | 0 | my ( $self, $value ) = @_; | |||||||||||||||||||||||||||
| 65 | 0 | ▶ | if ( $value ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 66 | 0 | $self->{_header}{'Content-Type'} = $value; | |||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | 0 | return $self->{_header}{'Content-Type'}; | |||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | 0 | ▶ | sub content_type_header { | ||||||||||||||||||||||||||
|
Subroutine
content_type_header: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 73 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||
| 74 | 0 | my $content_type = $self->content_type; | |||||||||||||||||||||||||||
| 75 | 0 | ▶ | if ( $self->charset ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 76 | 0 | $content_type .= "; charset=" . $self->charset; | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | 0 | return $content_type; | |||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | # TODO: We may want to dereference $self->{_header} before sending it | ||||||||||||||||||||||||||||
| 83 | # back, otherwise people can add headers directly to the hash. OTOH, | ||||||||||||||||||||||||||||
| 84 | # this may be a good thing... | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | # TODO: Use an HTTP::Headers object here? | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub header { | ||||||||||||||||||||||||||
|
Subroutine
header: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 89 | 0 | my ( $self, $name, $value ) = @_; | |||||||||||||||||||||||||||
| 90 | 0 | ▶ | unless ( $name ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 91 | 0 | return $self->{_header}; | |||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | 0 | ▶ | $log ||= get_logger( LOG_RESPONSE ); | ||||||||||||||||||||||||||
|
Condition0%0/3
$log ||= get_logger("OI2.RESPONSE")
MC/DC0%0/2
$log ||= get_logger("OI2.RESPONSE")
$log
get_logger("OI2.RESPONSE")
Truth table0%0/3
A ||= B
A= $logB= get_logger("OI2.RESPONSE")
| |||||||||||||||||||||||||||||
| 94 | 0 | ▶ | if ( $value ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | 0 | $self->{_header}{ $name } = $value; | |||||||||||||||||||||||||||
| 96 | 0 | ▶ | $log->is_debug && | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 97 | $log->debug( "Setting header '$name' to '$value'" ); | ||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | 0 | return $self->{_header}{ $name }; | |||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | 0 | ▶ | sub remove_header { | ||||||||||||||||||||||||||
|
Subroutine
remove_header: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 103 | 0 | my ( $self, $name ) = @_; | |||||||||||||||||||||||||||
| 104 | 0 | ▶ | $log ||= get_logger( LOG_RESPONSE ); | ||||||||||||||||||||||||||
|
Condition0%0/3
$log ||= get_logger("OI2.RESPONSE")
MC/DC0%0/2
$log ||= get_logger("OI2.RESPONSE")
$log
get_logger("OI2.RESPONSE")
Truth table0%0/3
A ||= B
A= $logB= get_logger("OI2.RESPONSE")
| |||||||||||||||||||||||||||||
| 105 | 0 | ▶ | if ( $name ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 106 | 0 | ▶ | $log->is_debug && | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 107 | $log->debug( "Removing header '$name' from response" ); | ||||||||||||||||||||||||||||
| 108 | 0 | return delete $self->{_header}{ $name }; | |||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 0 | ▶ | sub is_redirect { | ||||||||||||||||||||||||||
|
Subroutine
is_redirect: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 113 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||
| 114 | 0 | ▶ | my $is_redir = ( $self->status && $self->status == RC_FOUND ); | ||||||||||||||||||||||||||
|
Condition0%0/3
$self->status && $self->status == 302
MC/DC0%0/2
$self->status && $self->status == 302
$self->status
$self->status == 302
Truth table0%0/3
A && B
A= $self->statusB= $self->status == 302
| |||||||||||||||||||||||||||||
| 115 | 0 | ▶ | $log->is_debug && | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 116 | $log->debug( sprintf( "Checking to see if status '%s' is redirect: %s", | ||||||||||||||||||||||||||||
| 117 | $self->status, $is_redir ) ); | ||||||||||||||||||||||||||||
| 118 | 0 | return $is_redir; | |||||||||||||||||||||||||||
| 119 | } | ||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||
| 121 | # Cookies are special types of headers; the response should collect | ||||||||||||||||||||||||||||
| 122 | # all of these and put them into the header in send() | ||||||||||||||||||||||||||||
| 123 | # $cookie should be a CGI::Cookie object | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 0 | ▶ | sub cookie { | ||||||||||||||||||||||||||
|
Subroutine
cookie: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 126 | 0 | my ( $self, $cookie ) = @_; | |||||||||||||||||||||||||||
| 127 | 0 | ▶ | $log ||= get_logger( LOG_RESPONSE ); | ||||||||||||||||||||||||||
|
Condition0%0/3
$log ||= get_logger("OI2.RESPONSE")
MC/DC0%0/2
$log ||= get_logger("OI2.RESPONSE")
$log
get_logger("OI2.RESPONSE")
Truth table0%0/3
A ||= B
A= $logB= get_logger("OI2.RESPONSE")
| |||||||||||||||||||||||||||||
| 128 | 0 | ▶ | unless ( $cookie ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 129 | 0 | return [ values %{ $self->{_cookie} } ]; | |||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||
| 131 | 0 | ▶ | unless ( UNIVERSAL::isa( $cookie, 'CGI::Cookie' ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 132 | 0 | $log->warn( "Tried to add a 'cookie()' to the response without ", | |||||||||||||||||||||||||||
| 133 | "passing a valid cookie object. (Must be a ", | ||||||||||||||||||||||||||||
| 134 | "'CGI::Cookie' object or have it as a parent.)" ); | ||||||||||||||||||||||||||||
| 135 | 0 | return; | |||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||
| 137 | 0 | my $name = $cookie->name; | |||||||||||||||||||||||||||
| 138 | 0 | ▶ | unless ( $name ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 139 | 0 | $log->warn( "Cannot add cookie to response without a name; ", | |||||||||||||||||||||||||||
| 140 | "please ensure the 'CGI::Cookie' object set has a name" ); | ||||||||||||||||||||||||||||
| 141 | 0 | return; | |||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||
| 143 | $log->is_debug && | ||||||||||||||||||||||||||||
| 144 | 0 | ▶ | $log->debug( "Setting cookie '$name' to '$cookie'" ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 145 | 0 | $self->{_cookie}{ $name } = $cookie; | |||||||||||||||||||||||||||
| 146 | 0 | return $cookie; | |||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 0 | ▶ | sub remove_cookie { | ||||||||||||||||||||||||||
|
Subroutine
remove_cookie: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 150 | 0 | my ( $self, $name ) = @_; | |||||||||||||||||||||||||||
| 151 | 0 | ▶ | $log ||= get_logger( LOG_RESPONSE ); | ||||||||||||||||||||||||||
|
Condition0%0/3
$log ||= get_logger("OI2.RESPONSE")
MC/DC0%0/2
$log ||= get_logger("OI2.RESPONSE")
$log
get_logger("OI2.RESPONSE")
Truth table0%0/3
A ||= B
A= $logB= get_logger("OI2.RESPONSE")
| |||||||||||||||||||||||||||||
| 152 | 0 | ▶ | if ( $name ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 153 | 0 | ▶ | $log->is_debug && | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 154 | $log->debug( "Removing cookie '$name' from response" ); | ||||||||||||||||||||||||||||
| 155 | 0 | return delete $self->{_cookie}{ $name }; | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | } | ||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||
| 159 | |||||||||||||||||||||||||||||
| 160 | 0 | ▶ | sub save_session { | ||||||||||||||||||||||||||
|
Subroutine
save_session: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 161 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||
| 162 | 0 | OpenInteract2::SessionManager->save( CTX->request->session ); | |||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | 0 | ▶ | sub set_file_info { | ||||||||||||||||||||||||||
|
Subroutine
set_file_info: not called CC=10 SCAR=47.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 167 | 0 | my ( $self ) = @_; | |||||||||||||||||||||||||||
| 168 | 0 | ▶ | $log ||= get_logger( LOG_RESPONSE ); | ||||||||||||||||||||||||||
|
Condition0%0/3
$log ||= get_logger("OI2.RESPONSE")
MC/DC0%0/2
$log ||= get_logger("OI2.RESPONSE")
$log
get_logger("OI2.RESPONSE")
Truth table0%0/3
A ||= B
A= $logB= get_logger("OI2.RESPONSE")
| |||||||||||||||||||||||||||||
| 169 | 0 | my $filename = $self->send_file; | |||||||||||||||||||||||||||
| 170 | 0 | my $filehandle = $self->send_filehandle; | |||||||||||||||||||||||||||
| 171 | 0 | ▶ | unless ( $filename || $filehandle ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$filename or $filehandle
MC/DC0%0/2
$filename or $filehandle
$filename
$filehandle
Truth table0%0/3
A or B
A= $filenameB= $filehandle
| |||||||||||||||||||||||||||||
| 172 | 0 | return undef; | |||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 0 | ▶ | if ( $filename ) { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 176 | 0 | ▶ | unless ( -f $filename ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 177 | 0 | oi_error "Cannot set outbound file information for ", | |||||||||||||||||||||||||||
| 178 | "'$filename': file does not exist"; | ||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||
| 180 | $log->is_debug && | ||||||||||||||||||||||||||||
| 181 | 0 | ▶ | $log->debug( "Set response information for file '$filename'" ); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 182 | 0 | ▶ | unless ( $self->header( 'Content-Length' ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 183 | 0 | $self->header( 'Content-Length', (stat $filename)[7] ); | |||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||
| 185 | 0 | ▶ | unless ( $self->header( 'Content-Type' ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 186 | 0 | $self->content_type( | |||||||||||||||||||||||||||
| 187 | OpenInteract2::File->get_mime_type({ | ||||||||||||||||||||||||||||
| 188 | filename => $filename | ||||||||||||||||||||||||||||
| 189 | }) | ||||||||||||||||||||||||||||
| 190 | ); | ||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||
| 193 | elsif ( $filehandle ) { | ||||||||||||||||||||||||||||
| 194 | 0 | $self->header( 'Content-Length', (stat $filehandle)[7] ); | |||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||
| 198 | ######################################## | ||||||||||||||||||||||||||||
| 199 | # PROPERTIES | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | 0 | ▶ | sub return_url { | ||||||||||||||||||||||||||
|
Subroutine
return_url: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 202 | 0 | my ( $self, $return_url ) = @_; | |||||||||||||||||||||||||||
| 203 | 0 | ▶ | if ( $return_url ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 204 | $self->{return_url} = | ||||||||||||||||||||||||||||
| 205 | 0 | OpenInteract2::URL->create_relative_to_absolute( $return_url ); | |||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | 0 | ▶ | unless ( $self->{return_url} ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 208 | 0 | ▶ | my $url = DEPLOY_URL || '/'; | ||||||||||||||||||||||||||
|
Condition0%0/2
DEPLOY_URL() || '/'
MC/DC0%0/1
DEPLOY_URL() || '/'
DEPLOY_URL()
Truth table0%0/2
A
A= DEPLOY_URL()
| |||||||||||||||||||||||||||||
| 209 | $self->{return_url} = | ||||||||||||||||||||||||||||
| 210 | 0 | OpenInteract2::URL->create_relative_to_absolute( $url ); | |||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||
| 212 | 0 | return $self->{return_url}; | |||||||||||||||||||||||||||
| 213 | } | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | ######################################## | ||||||||||||||||||||||||||||
| 216 | # FACTORY | ||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | 0 | ▶ | sub factory_log { | ||||||||||||||||||||||||||
|
Subroutine
factory_log: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 219 | 0 | my ( $self, @msg ) = @_; | |||||||||||||||||||||||||||
| 220 | 0 | get_logger( LOG_RESPONSE )->info( @msg ); | |||||||||||||||||||||||||||
| 221 | } | ||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | 0 | ▶ | sub factory_error { | ||||||||||||||||||||||||||
|
Subroutine
factory_error: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 224 | 0 | my ( $self, @msg ) = @_; | |||||||||||||||||||||||||||
| 225 | 0 | get_logger( LOG_RESPONSE )->error( @msg ); | |||||||||||||||||||||||||||
| 226 | 0 | die @msg, "\n"; | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||
| 230 | ######################################## | ||||||||||||||||||||||||||||
| 231 | # OVERRIDE | ||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||
| 233 | # Initialize new object | ||||||||||||||||||||||||||||
| 234 | 0 | ▶ | sub init { die "Subclass must implement init()" } | ||||||||||||||||||||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | # Set/send HTTP headers + cookies + content | ||||||||||||||||||||||||||||
| 237 | 0 | ▶ | sub send { die "Subclass must implement send()" } | ||||||||||||||||||||||||||
|
Subroutine
send: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | # Redirect to another URL (yay, proper HTTP redirects!) | ||||||||||||||||||||||||||||
| 240 | 0 | ▶ | sub redirect { die "Subclass must implement redirect()" } | ||||||||||||||||||||||||||
|
Subroutine
redirect: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||
| 242 | 87 | 1; | |||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | __END__ | ||||||||||||||||||||||||||||