Index: lang/perl/Sledge-View/trunk/t/01.base.t
===================================================================
--- lang/perl/Sledge-View/trunk/t/01.base.t (revision 14076)
+++ lang/perl/Sledge-View/trunk/t/01.base.t (revision 14077)
@@ -31,4 +31,15 @@
 --- expected
 Content-Length: 10
+Content-Type: text/html; charset=euc-jp
+
+#abc: foo
+
+=== set header
+--- input
+$self->tmpl->param(abc => 'foo');
+$self->res->header(Boo => 'ffy');
+--- expected
+Content-Length: 10
+Boo: ffy
 Content-Type: text/html; charset=euc-jp
 
Index: lang/perl/Sledge-View/trunk/lib/Sledge/View.pm
===================================================================
--- lang/perl/Sledge-View/trunk/lib/Sledge/View.pm (revision 14076)
+++ lang/perl/Sledge-View/trunk/lib/Sledge/View.pm (revision 14077)
@@ -2,5 +2,5 @@
 use strict;
 use warnings;
-our $VERSION = 0.02;
+our $VERSION = 0.03;
 use Sledge::Exceptions;
 
Index: lang/perl/Sledge-View/trunk/lib/Sledge/Response.pm
===================================================================
--- lang/perl/Sledge-View/trunk/lib/Sledge/Response.pm (revision 14071)
+++ lang/perl/Sledge-View/trunk/lib/Sledge/Response.pm (revision 14077)
@@ -3,6 +3,13 @@
 use warnings;
 use base qw/Class::Accessor::Fast/;
+use HTTP::Headers;
 
-__PACKAGE__->mk_accessors(qw/body content_type/);
+__PACKAGE__->mk_accessors(qw/body headers/);
+sub content_encoding { shift->headers->content_encoding(@_) }
+sub content_length   { shift->headers->content_length(@_) }
+sub content_type     { shift->headers->content_type(@_) }
+sub header           { shift->headers->header(@_) }
+
+sub new { bless { headers => HTTP::Headers->new }, shift }
 
 1;
@@ -26,5 +33,15 @@
 HTTP response object for Sledge.
 
+yeah, this module is copy of Catalyst::Response.
+
 =head1 METHODS
+
+=head2 new
+
+create new instance.
+
+=head2 header
+
+Shortcut for $res->headers->header.
 
 =head2 body
@@ -36,4 +53,16 @@
 HTTP Response content_type.
 
+=head2 content_encoding
+
+Shortcut for $res->headers->content_encoding.
+
+=head2 content_length
+
+Shortcut for $res->headers->content_length.
+
+=head2 content_type
+
+Shortcut for $res->headers->content_type.
+
 =head1 BUGS AND LIMITATIONS
 
@@ -44,4 +73,8 @@
 Tokuhiro Matsuno  C<< <tokuhiro __at__ mobilefactory.jp> >>
 
+=head1 SEE ALSO
+
+L<Catalyst::Response>
+
 =head1 LICENCE AND COPYRIGHT
 
Index: lang/perl/Sledge-View/trunk/lib/Sledge/Plugin/View.pm
===================================================================
--- lang/perl/Sledge-View/trunk/lib/Sledge/Plugin/View.pm (revision 14076)
+++ lang/perl/Sledge-View/trunk/lib/Sledge/Plugin/View.pm (revision 14077)
@@ -9,5 +9,4 @@
     my $pkg = caller(0);
 
-    # add BEFORE_OUTPUT trigger
     no strict 'refs'; ## no critic
     *{"$pkg\::output_content"} = sub {
@@ -19,6 +18,6 @@
         }
 
-        $self->r->content_type($self->response->content_type);
-        $self->set_content_length(length $self->response->body);
+        $self->res->content_length(length $self->response->body);
+        _finalize_header($self);
         $self->send_http_header;
 
@@ -62,4 +61,29 @@
         return $class->new($self);
     };
+}
+
+# copy from http://search.cpan.org/src/AGRUNDMA/Catalyst-Engine-Apache-1.07/lib/Catalyst/Engine/Apache.pm
+sub _finalize_header {
+    my $self = shift;
+
+    for my $name ( $self->response->headers->header_field_names ) {
+        next if $name =~ /^Content-(Length|Type)$/i;
+
+        my @values = $self->response->header($name);
+        # allow X headers to persist on error
+        if ( $name =~ /^X-/i ) {
+            $self->r->err_headers_out->add( $name => $_ ) for @values;
+        }
+        else {
+            $self->r->headers_out->add( $name => $_ ) for @values;
+        }
+    }
+
+    my $type = $self->response->header('Content-Type') || 'text/html';
+    $self->r->content_type( $type );
+
+    if ( my $length = $self->response->content_length ) {
+        $self->set_content_length( $length );
+    }
 }
 
Index: lang/perl/Sledge-View/trunk/Makefile.PL
===================================================================
--- lang/perl/Sledge-View/trunk/Makefile.PL (revision 14076)
+++ lang/perl/Sledge-View/trunk/Makefile.PL (revision 14077)
@@ -6,4 +6,5 @@
 all_from        'lib/Sledge/View.pm';
 
+requires 'HTTP::Headers' => 0;
 requires 'Class::Accessor::Fast' => 0;
 requires 'UNIVERSAL::require' => 0;
Index: lang/perl/Sledge-View/trunk/Changes
===================================================================
--- lang/perl/Sledge-View/trunk/Changes (revision 14076)
+++ lang/perl/Sledge-View/trunk/Changes (revision 14077)
@@ -1,3 +1,6 @@
 Revision history for Sledge-View
+
+0.0.3  Fri Nov  3 00:20:41 JST 2006
+       Sledge::Response: use HTTP::Headers
 
 0.0.2  Thu Nov  2 21:12:52 JST 2006
