diff Lib/IMPL/Web/HttpResponse.pm @ 230:6d8092d8ce1b

*reworked IMPL::Security *reworked IMPL::Web::Security *refactoring
author sergey
date Mon, 08 Oct 2012 03:37:37 +0400
parents 47f77e6409f7
children 23daf2fae33a
line wrap: on
line diff
--- a/Lib/IMPL/Web/HttpResponse.pm	Sat Sep 29 02:34:47 2012 +0400
+++ b/Lib/IMPL/Web/HttpResponse.pm	Mon Oct 08 03:37:37 2012 +0400
@@ -48,7 +48,7 @@
 	   binmode $out, ":encoding($charset)";
 	}
 	
-	$q->header(\%headers);
+	print $out $q->header(\%headers);
 	
 	if(my $body = $this->body) {
 		if(ref $body eq 'CODE') {
@@ -64,6 +64,25 @@
     return UNIVERSAL::isa($_[1], 'CGI::Cookie') ? $_[1] : CGI::Cookie->new(-name => $_[0], -value => $_[1] );
 }
 
+sub InternalError {
+    my ($self,%args) = @_;
+    
+    $args{status} ||= '500 Internal Server Error';
+    
+    return $self->new(%args);
+}
+
+sub Redirect {
+    my ($self,%args) = @_;
+    
+    return $self->new(
+        status => $args{status} || '303 See other',
+        headers => {
+            location => $args{location}
+        }
+    );
+}
+
 1;
 
 __END__