Gungho/Response.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 44 CC 3 SCAR 16.7
CC
3
Cov
0%
notes
12.0
new
2.0
clone
2.0
CRAP 5.3
1 # $Id$
2 #
3 # Copyright (c) 2007 Daisuke Maki <daisuke@endeworks.jp>
4 # All rights reserved.
5  
6 package Gungho::Response;
7 use strict;
8 use warnings;
9 use base qw(HTTP::Response);
10 use Storable qw(dclone);
11  
12 sub new
13 {
14 my $class = shift;
15 my $self = $class->SUPER::new(@_);
16 $self->{_notes} = {};
17 return $self;
18 }
19  
20 sub 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  
31 sub 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  
45 1;
46  
47 __END__