/[suikacvs]/messaging/manakai/lib/Message/Field/Unstructured.pm
Suika

Diff of /messaging/manakai/lib/Message/Field/Unstructured.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by wakaba, Fri Apr 5 14:55:28 2002 UTC revision 1.6 by wakaba, Sat May 4 06:03:58 2002 UTC
# Line 21  use overload '""' => sub { $_[0]->string Line 21  use overload '""' => sub { $_[0]->string
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) {
# Line 169  Returns a copy of Message::Field::Unstru Line 169  Returns a copy of Message::Field::Unstru
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    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24