Changeset 1091 for trunk/lib/OpenGuides/Template.pm
- Timestamp:
- 06/18/07 16:20:16 (18 months ago)
- Files:
-
- 1 modified
-
trunk/lib/OpenGuides/Template.pm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/OpenGuides/Template.pm
r1085 r1091 51 51 content_type => "text/html", 52 52 cookies => $cookie, 53 vars => {foo => "bar"} 53 vars => {foo => "bar"}, 54 noheaders => 1 54 55 ); 55 56 … … 111 112 Content-Type: defaults to C<text/html> and is omitted if the 112 113 C<content_type> arg is explicitly set to the blank string. 114 115 However, what you more often need is the C<noheaders> option, 116 which suppresses all HTTP headers, not just the Content-Type. 113 117 114 118 The HTTP response code may be explictly set with the C<http_status> arg. … … 188 192 189 193 my $header = ""; 190 my %cgi_header_args; 191 192 if ( defined $args{content_type} and $args{content_type} eq "" ) { 193 $cgi_header_args{'-type'} = ''; 194 } else { 195 if ( $args{content_type} ) { 196 $cgi_header_args{'-type'} = $args{content_type}; 194 195 unless ( $args{noheaders} ) { 196 my %cgi_header_args; 197 198 if ( defined $args{content_type} and $args{content_type} eq "" ) { 199 $cgi_header_args{'-type'} = ''; 197 200 } else { 198 $cgi_header_args{'-type'} = "text/html"; 199 } 201 if ( $args{content_type} ) { 202 $cgi_header_args{'-type'} = $args{content_type}; 203 } else { 204 $cgi_header_args{'-type'} = "text/html"; 205 } 206 } 207 200 208 if ( $tt_vars->{http_charset} ) { 201 209 $cgi_header_args{'-type'} .= "; charset=".$tt_vars->{http_charset}; 202 210 } 203 # XXX should possibly not be inside this block, but retaining204 # existing functionality for now. See205 # http://dev.openguides.org/ticket/220206 211 $cgi_header_args{'-cookie'} = $args{cookies}; 207 } 208 209 if ( $args{http_status} ) {210 $cgi_header_args{'-status'} = $args{http_status};211 } 212 213 $header = CGI::header( %cgi_header_args );212 213 if ( $args{http_status} ) { 214 $cgi_header_args{'-status'} = $args{http_status}; 215 } 216 217 $header = CGI::header( %cgi_header_args ); 218 } 214 219 215 220 # vile hack … … 220 225 metadata => {}, 221 226 ); 222 227 223 228 $tt_vars = { %field_vars, %$tt_vars }; 224 229
