21 |
sub _init ($;%) { |
sub _init ($;%) { |
22 |
my $self = shift; |
my $self = shift; |
23 |
my %options = @_; |
my %options = @_; |
24 |
$self->{option} = { |
$self->{option} = Message::Util::make_clone ({ |
25 |
encoding_after_encode => '*default', |
encoding_after_encode => '*default', |
26 |
encoding_before_decode => '*default', |
encoding_before_decode => '*default', |
27 |
hook_encode_string => #sub {shift; (value => shift, @_)}, |
hook_encode_string => #sub {shift; (value => shift, @_)}, |
28 |
\&Message::Util::encode_header_string, |
\&Message::Util::encode_header_string, |
29 |
hook_decode_string => #sub {shift; (value => shift, @_)}, |
hook_decode_string => #sub {shift; (value => shift, @_)}, |
30 |
\&Message::Util::decode_header_string, |
\&Message::Util::decode_header_string, |
31 |
}; |
}); |
32 |
$self->{field_body} = ''; |
$self->{field_body} = ''; |
33 |
|
|
34 |
for my $name (keys %options) { |
for my $name (keys %options) { |
169 |
sub clone ($) { |
sub clone ($) { |
170 |
my $self = shift; |
my $self = shift; |
171 |
my $clone = ref($self)->new; |
my $clone = ref($self)->new; |
172 |
for my $name (%{$self->{option}}) { |
$clone->{option} = Message::Util::make_clone ($self->{option}); |
173 |
if (ref $self->{option}->{$name} eq 'HASH') { |
$clone->{field_body} = Message::Util::make_clone ($self->{field_body}); |
|
$clone->{option}->{$name} = {%{$self->{option}->{$name}}}; |
|
|
} elsif (ref $self->{option}->{$name} eq 'ARRAY') { |
|
|
$clone->{option}->{$name} = [@{$self->{option}->{$name}}]; |
|
|
} else { |
|
|
$clone->{option}->{$name} = $self->{option}->{$name}; |
|
|
} |
|
|
} |
|
|
$clone->{field_body} = ref $self->{field_body}? |
|
|
$self->{field_body}->clone: |
|
|
$self->{field_body}; |
|
174 |
$clone; |
$clone; |
175 |
} |
} |
176 |
|
|