1# $Id$
2#
3# Copyright (c) 2007 Daisuke Maki <daisuke@endeworks.jp>
4# All rights reserved.
5
6package Gungho::Response;
7use strict;
8use warnings;
9use base qw(HTTP::Response);
10use Storable qw(dclone);
11
12sub new
13{
14    my $class = shift;
15    my $self  = $class->SUPER::new(@_);
16    $self->{_notes} = {};
17    return $self;
18}
19
20sub clone
21{
22    my $self  = shift;
23    my $clone = $self->SUPER::clone;
24    my $cloned_notes = dclone $self->notes;
25    foreach my $note (keys %$cloned_notes) {
26        $clone->notes( $note => $cloned_notes->{$note} );
27    }
28    return $clone;
29}
30
31sub notes
32{
33    my $self = shift;
34    my $key  = shift;
35
36    return $self->{_notes} unless $key;
37
38    my $value = $self->{_notes}{$key};
39    if (@_) {
40        $self->{_notes}{$key} = $_[0];
41    }
42    return $value;
43}
44
451;
46
47__END__
48
49=head1 NAME
50
51Gungho::Response - Gungho HTTP Response Object
52
53=head1 DESCRIPTION
54
55This module is exactly the same as HTTP::Response, but adds notes()
56
57=head1 METHODS
58
59=head2 new
60
61=head2 clone
62
63=head2 notes
64
65=cut
66