/[suikacvs]/test/cvs
Suika

Diff of /test/cvs

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

revision 1.19 by wakaba, Wed May 15 07:31:28 2002 UTC revision 1.29 by wakaba, Wed Jul 3 23:39:15 2002 UTC
# Line 1  Line 1 
1    
2  =head1 NAME  =head1 NAME
3    
4  Message::Header Perl module  Message::Header --- A Perl Module for Internet Message Headers
   
 =head1 DESCRIPTION  
   
 Perl module for RFC 822/2822 message C<header>.  
5    
6  =cut  =cut
7    
8  package Message::Header;  package Message::Header;
9  use strict;  use strict;
10  use vars qw($VERSION %REG);  use vars qw(%DEFAULT @ISA %REG $VERSION);
11  $VERSION = '1.00';  $VERSION=do{my @r=(q$Revision$=~/\d+/g);sprintf "%d."."%02d" x $#r,@r};
12  use Carp ();  require Message::Field::Structured;     ## This may seem silly:-)
13  use overload '@{}' => sub { shift->_delete_empty_field->{field} },  push @ISA, qw(Message::Field::Structured);
14               '""' => sub { shift->stringify },  
15               fallback => 1;  %REG = %Message::Util::REG;
16            $REG{M_field} = qr/^([^\x3A]+):$REG{FWS}([\x00-\xFF]*)$/;
17  $REG{WSP}     = qr/[\x09\x20]/;          $REG{M_fromline} = qr/^\x3E?From$REG{WSP}+([\x00-\xFF]*)$/;
18  $REG{FWS}     = qr/[\x09\x20]*/;          $REG{ftext} = qr/[\x21-\x39\x3B-\x7E]+/;        ## [2]822
19  $REG{M_field} = qr/^([^\x3A]+):$REG{FWS}([\x00-\xFF]*)$/;          $REG{NON_ftext} = qr/[^\x21-\x39\x3B-\x7E]/;    ## [2]822
20  $REG{M_fromline} = qr/^\x3E?From$REG{WSP}+([\x00-\xFF]*)$/;          $REG{NON_ftext_usefor} = qr/[^0-9A-Za-z-]/;     ## name-character
21  $REG{UNSAFE_field_name} = qr/[\x00-\x20\x3A\x7F-\xFF]/;          $REG{NON_ftext_http} = $REG{NON_http_token};
22    
23  =head2 options  ## Namespace support
24            our %NS_phname2uri;     ## PH-namespace name -> namespace URI
25  These options can be getten/set by C<get_option>/C<set_option>          our %NS_uri2phpackage;  ## namespace URI -> PH-package name
26  method.          require Message::Header::Default;       ## Default namespace
27    
28  =head3 capitalize = 0/1  ## Initialize of this class -- called by constructors
29    %DEFAULT = (
30  (First character of) C<field-name> is capitalized      -_HASH_NAME => 'value',
31  when C<stringify>.  (Default = 1)      -_METHODS   => [qw|field field_exist field_type add replace count delete subject id is|],
32        -_MEMBERS   => [qw|value|],
33  =head3 fold_length = numeric value      -_VALTYPE_DEFAULT   => ':default',
34        -by => 'name',      ## (Reserved for method level option)
35  Length of line used to fold.  (Default = 70)      -field_format_pattern       => '%s: %s',
36        -field_name_case_sensible   => 0,
37  =head3 mail_from = 0/1      -field_name_unsafe_rule     => 'NON_ftext',
38        -field_name_validation      => 0,
39  Outputs "From " line (known as Un*x From, Mail-From, and so on)      -field_sort => 0,
40  when C<stringify>.  (Default = 0)      #-format    => 'mail-rfc2822',
41        -header_default_charset     => 'iso-2022-int-1',
42  =cut      -header_default_charset_input       => 'iso-2022-int-1',
43        -linebreak_strict   => 0,   ## Not implemented completely
44  =head1 CONSTRUCTORS      -line_length_max    => 60,  ## For folding
45        #ns_default_phuri
46  The following methods construct new C<Message::Header> objects:      -output_bcc => 0,
47        -output_folding     => 1,
48  =over 4      -output_mail_from   => 0,
49        #-parse_all => 0,
50  =cut      -translate_underscore       => 1,
51        #-uri_mailto_safe
52  ## Initialize      -uri_mailto_safe_level      => 4,
53  my %DEFAULT = (      -use_folding        => 1,
54    capitalize    => 1,      #-value_type
   fold  => 1,  
   fold_length   => 70,  
   field_format_pattern  => '%s: %s',  
   #field_type   => {},  
   format        => 'mail-rfc2822',  
   linebreak_strict      => 0,  
   mail_from     => 0,  
   output_bcc    => 0,  
   parse_all     => 0,  
   sort  => 'none',  
   translate_underscore  => 1,  
   uri_mailto_safe       => {  
         ## 1 all (no check)     2 no trace & bcc & from  
         ## 3 no sender's info   4 (default) (currently not used)  
         ## 5 only a few  
         ':default'      => 4,  
         'cc'    => 4,  
         'bcc'   => 1,  
         'body'  => 1,  
         'comment'       => 5,  
         'content-id'    => 1,  
         'date'  => 1,  
         'from'  => 1,  
         'keywords'      => 5,  
         'list-id'       => 1,  
         'mail-from'     => 1,  
         'message-id'    => 1,  
         'received'      => 1,  
         'resent-bcc'    => 1,  
         'resent-date'   => 1,  
         'resent-from'   => 1,  
         'resent-sender' => 1,  
         'return-path'   => 1,  
         'sender'        => 1,  
         'subject'       => 5,  
         'summary'       => 5,  
         'to'    => 4,  
         'user-agent'    => 3,  
         'x-face'        => 2,  
         'x-mailer'      => 3,  
         'x-nsubject'    => 5,  
         'x-received'    => 1,  
         'x400-received' => 1,  
         },  
   uri_mailto_safe_level => 4,  
   validate      => 1,  
55  );  );
56  $DEFAULT{field_type} = {  
57          ':DEFAULT'      => 'Message::Field::Unstructured',  $DEFAULT{-value_type} = {
58                    ':default'      => ['Message::Field::Unstructured'],
         received        => 'Message::Field::Received',  
         'x-received'    => 'Message::Field::Received',  
           
         'content-type'  => 'Message::Field::ContentType',  
         p3p     => 'Message::Field::Params',  
         'auto-submitted'        => 'Message::Field::ValueParams',  
         'content-disposition'   => 'Message::Field::ValueParams',  
         link    => 'Message::Field::ValueParams',  
         archive => 'Message::Field::ValueParams',  
         'x-face-type'   => 'Message::Field::ValueParams',  
         'x-mozilla-draft-info'  => 'Message::Field::ValueParams',  
           
         subject => 'Message::Field::Subject',  
         'x-nsubject'    => 'Message::Field::Subject',  
           
         'list-software' => 'Message::Field::UA',  
         'user-agent'    => 'Message::Field::UA',  
         'resent-user-agent'     => 'Message::Field::UA',  
         server  => 'Message::Field::UA',  
           
         ## A message id  
         'content-id'    => 'Message::Field::MsgID',  
         'message-id'    => 'Message::Field::MsgID',  
         'resent-message-id'     => 'Message::Field::MsgID',  
59                    
60          ## Numeric value          p3p     => ['Message::Field::Params'],
61          'content-length'        => 'Message::Field::Numval',          link    => ['Message::Field::ValueParams'],
         lines   => 'Message::Field::Numval',  
         'max-forwards'  => 'Message::Field::Numval',  
         'mime-version'  => 'Message::Field::Numval',  
         'x-jsmail-priority'     => 'Message::Field::Numval',  
         'x-mail-count'  => 'Message::Field::Numval',  
         'x-ml-count'    => 'Message::Field::Numval',  
         'x-priority'    => 'Message::Field::Numval',  
62                    
63          path    => 'Message::Field::Path',          'user-agent'    => ['Message::Field::UA'],
64            server  => ['Message::Field::UA'],
65  };  };
66  for (qw(archive cancel-lock content-features content-md5  for (qw(date expires))
67    disposition-notification-options encoding    {$DEFAULT{-value_type}->{$_} = ['Message::Field::Date']}
68    importance injector-info  for (qw(accept accept-charset accept-encoding accept-language uri))
69    pics-label posted-and-mailed precedence list-id message-type    {$DEFAULT{-value_type}->{$_} = ['Message::Field::CSV']}
70    original-recipient priority x-list-id  for (qw(location referer))
71    sensitivity status x-face x-msmail-priority xref))    {$DEFAULT{-value_type}->{$_} = ['Message::Field::URI']}
   {$DEFAULT{field_type}->{$_} = 'Message::Field::Structured'}  
         ## Not supported yet, but to be supported...  
         # x-list: unstructured, ml name  
 for (qw(abuse-reports-to apparently-to approved approved-by bcc cc complaints-to  
   delivered-to disposition-notification-to envelope-to  
   errors-to  from mail-copies-to mail-followup-to mail-reply-to  
   notice-requested-upon-delivery-to read-receipt-to register-mail-reply-requested-by  
   reply-to resent-bcc  
   resent-cc resent-to resent-from resent-sender return-path  
   return-receipt-to return-receipt-requested-to sender to x-abuse-reports-to  
   x-admin x-approved x-beenthere x-confirm-reading-to  
   x-complaints-to x-envelope-from x-envelope-sender  
   x-envelope-to x-ml-address x-ml-command x-ml-to x-nfrom x-nto  
   x-rcpt-to x-sender x-x-sender))  
   {$DEFAULT{field_type}->{$_} = 'Message::Field::Addresses'}  
 for (qw(client-date date date-received delivery-date expires  
   expire-date nntp-posting-date posted posted-date received-date  
   reply-by resent-date  
   x-originalarrivaltime x-tcup-date))  
   {$DEFAULT{field_type}->{$_} = 'Message::Field::Date'}  
 for (qw(article-updates in-reply-to  
   obsoletes references replaces see-also supersedes))  
   {$DEFAULT{field_type}->{$_} = 'Message::Field::MsgIDs'}  
 for (qw(accept accept-charset accept-encoding accept-language  
   content-language  
   content-transfer-encoding encrypted followup-to keywords  
   list-archive list-digest list-help list-owner  
   list-post list-subscribe list-unsubscribe list-url uri newsgroups  
   posted-to))  
   {$DEFAULT{field_type}->{$_} = 'Message::Field::CSV'}  
 for (qw(x-brother x-boss x-classmate x-daughter x-dearfriend x-favoritesong  
   x-friend x-me  
   x-moe x-respect  
   x-sublimate x-son x-sister x-wife))  
   {$DEFAULT{field_type}->{$_} = 'Message::Field::CSV'}  ## NOT M::F::XMOE!  
 for (qw(content-alias content-base content-location location referer  
   url x-home-page x-http_referer  
   x-info x-pgp-key x-ml-url x-uri x-url x-web))  
   {$DEFAULT{field_type}->{$_} = 'Message::Field::URI'}  
72    
73  my %header_goodcase = (  my %header_goodcase = (
74          'article-i.d.'  => 'Article-I.D.',          'article-i.d.'  => 'Article-I.D.',
         'content-id'    => 'Content-ID',  
         'content-md5'   => 'Content-MD5',  
         'content-sgml-entity'   => 'Content-SGML-Entity',  
75          etag    => 'ETag',          etag    => 'ETag',
         fax     => 'FAX',  
76          'pics-label'    => 'PICS-Label',          'pics-label'    => 'PICS-Label',
         'list-url'      => 'List-URL',  
         'list-id'       => 'List-ID',  
         'message-id'    => 'Message-ID',  
         'mime-version'  => 'MIME-Version',  
         'nic'   => 'NIC',  
         'nntp-posting-date'     => 'NNTP-Posting-Date',  
         'nntp-posting-host'     => 'NNTP-Posting-Host',  
         'resent-message-id'     => 'Resent-Message-ID',  
77          te      => 'TE',          te      => 'TE',
78          url     => 'URL',          url     => 'URL',
79          'www-authenticate'      => 'WWW-Authenticate',          'www-authenticate'      => 'WWW-Authenticate',
         'x-dearfriend'  => 'X-DearFriend',  
         'x-mime-autoconverted'  => 'X-MIME-Autoconverted',  
         'x-nntp-posting-date'   => 'X-NNTP-Posting-Date',  
         'x-nntp-posting-host'   => 'X-NNTP-Posting-Host',  
         'x-uri' => 'X-URI',  
         'x-url' => 'X-URL',  
80  );  );
 $DEFAULT{capitalize} = sub {  
   my $self = shift;  
   my $name = shift;  
   if ($header_goodcase{$name}) {  
     return $header_goodcase{$name};  
   }  
   $name =~ s/(?:^|-)cgi-/uc $&/ge;  
   $name =~ s/(?:^|-)[a-z]/uc $&/ge;  
   $name;  
 };  
81    
82  ## taken from L<HTTP::Header>  ## taken from L<HTTP::Header>
83  # "Good Practice" order of HTTP message headers:  # "Good Practice" order of HTTP message headers:
# Line 256  my @header_order = qw( Line 109  my @header_order = qw(
109  );  );
110  my %header_order;  my %header_order;
111    
112    =head1 CONSTRUCTORS
113    
114    The following methods construct new C<Message::Header> objects:
115    
116    =over 4
117    
118    =cut
119    
120  sub _init ($;%) {  sub _init ($;%) {
121    my $self = shift;    my $self = shift;
122    my %options = @_;    my %options = @_;
123    $self->{field} = [];    my $DEFAULT = Message::Util::make_clone (\%DEFAULT);
124    $self->{option} = \%DEFAULT;    $self->SUPER::_init (%$DEFAULT, %options);
125      $self->{value} = [];
126      $self->_ns_load_ph ('default');
127      $self->_ns_load_ph ('rfc822');
128      $self->{option}->{ns_default_phuri} = $self->{ns}->{phname2uri}->{'rfc822'}
129        unless $self->{option}->{ns_default_phuri};
130      
131      ## For text/rfc822-headers
132      if (ref $options{entity_header}) {
133        $self->{entity_header} = $options{entity_header};
134        delete $options{entity_header};
135      }
136    my @new_fields = ();    my @new_fields = ();
137    for my $name (keys %options) {    for my $name (keys %options) {
138      if (substr ($name, 0, 1) eq '-') {      unless (substr ($name, 0, 1) eq '-') {
       $self->{option}->{substr ($name, 1)} = $options{$name};  
     } else {  
139        push @new_fields, ($name => $options{$name});        push @new_fields, ($name => $options{$name});
140      }      }
141    }    }
# Line 284  sub _init ($;%) { Line 154  sub _init ($;%) {
154  sub _init_by_format ($$\%) {  sub _init_by_format ($$\%) {
155    my $self = shift;    my $self = shift;
156    my ($format, $option) = @_;    my ($format, $option) = @_;
157    if ($format =~ /rfc822/) {    if ($format =~ /cgi/) {
     $header_goodcase{bcc} = 'bcc';  
     $header_goodcase{cc} = 'cc';  
     $header_goodcase{'resent-bcc'} = 'Resent-bcc';  
     $header_goodcase{'resent-cc'} = 'Resent-cc';  
   } elsif ($format =~ /cgi/) {  
158      unshift @header_order, qw(content-type location);      unshift @header_order, qw(content-type location);
159      $option->{sort} = 'good-practice';      $option->{field_sort} = 'good-practice';
160      $option->{fold} = 0;      $option->{use_folding} = 0;
161    } elsif ($format =~ /http/) {    } elsif ($format =~ /http/) {
162      $option->{sort} = 'good-practice';      $option->{field_sort} = 'good-practice';
163    }    }
164    if ($format =~ /uri-url-mailto/) {    if ($format =~ /uri-url-mailto/) {
165      $option->{output_bcc} = 0;      $option->{output_bcc} = 0;
     $option->{capitalize} = 0;  
166      $option->{field_format_pattern} = '%s=%s';      $option->{field_format_pattern} = '%s=%s';
167      $option->{fold} = sub {      $option->{output_folding} = sub {
168        $_[1] =~ s/([^:@+\$A-Za-z0-9\-_.!~*])/sprintf('%%%02X', ord $1)/ge;        $_[1] =~ s/([^:@+\$A-Za-z0-9\-_.!~*])/sprintf('%%%02X', ord $1)/ge;
169        $_[1];        $_[1];
170      };      };  ## Yes, this is not folding!
171    }    }
172  }  }
173    
174  =item Message::Header->new ([%initial-fields/options])  =item $msg = Message::Header->new ([%initial-fields/options])
175    
176  Constructs a new C<Message::Headers> object.  You might pass some initial  Constructs a new C<Message::Headers> object.  You might pass some initial
177  C<field-name>-C<field-body> pairs and/or options as parameters to the constructor.  C<field-name>-C<field-body> pairs and/or options as parameters to the constructor.
# Line 323  Example: Line 187  Example:
187    
188  =cut  =cut
189    
190  sub new ($;%) {  ## Inherited
   my $class = shift;  
   my $self = bless {}, $class;  
   $self->_init (@_);  
   $self;  
 }  
191    
192  =item Message::Header->parse ($header, [%initial-fields/options])  =item $msg = Message::Header->parse ($header, [%initial-fields/options])
193    
194  Parses given C<header> and constructs a new C<Message::Headers>  Parses given C<header> and constructs a new C<Message::Headers>
195  object.  You might pass some additional C<field-name>-C<field-body> pairs  object.  You might pass some additional C<field-name>-C<field-body> pairs
# Line 342  sub parse ($$;%) { Line 201  sub parse ($$;%) {
201    my $class = shift;    my $class = shift;
202    my $header = shift;    my $header = shift;
203    my $self = bless {}, $class;    my $self = bless {}, $class;
204    $self->_init (@_);    ## BUG: don't check linebreak_strict    $self->_init (@_);
205    $header =~ s/\x0D?\x0A$REG{WSP}/\x20/gos;     ## unfold    if ($self->{option}->{linebreak_strict}) {
206        $header =~ s/\x0D\x0A$REG{WSP}/\x20/gos if $self->{option}->{use_folding};
207      } else {
208        $header =~ s/\x0D?\x0A$REG{WSP}/\x20/gos if $self->{option}->{use_folding};
209      }
210    for my $field (split /\x0D?\x0A/, $header) {    for my $field (split /\x0D?\x0A/, $header) {
211      if ($field =~ /$REG{M_fromline}/) {      if ($field =~ /$REG{M_fromline}/) {
212        my $body = $1;        my ($s,undef,$value) = $self->_value_to_arrayitem
213        $body = $self->_field_body ($body, 'mail-from')          ('mail-from' => $1, $self->{option});
214          if $self->{option}->{parse_all};        push @{$self->{value}}, $value if $s;
       push @{$self->{field}}, {name => 'mail-from', body => $body};  
215      } elsif ($field =~ /$REG{M_field}/) {      } elsif ($field =~ /$REG{M_field}/) {
216        my ($name, $body) = (lc $1, $2);        my ($name, $body) = ($1, $2);
       $name =~ s/$REG{WSP}+$//;  
217        $body =~ s/$REG{WSP}+$//;        $body =~ s/$REG{WSP}+$//;
218        $body = $self->_field_body ($body, $name) if $self->{option}->{parse_all};        my ($s,undef,$value) = $self->_value_to_arrayitem
219        push @{$self->{field}}, {name => $name, body => $body};          ($name => $body, $self->{option});
220          push @{$self->{value}}, $value if $s;
221        } elsif (length $field) {
222          my ($s,undef,$value) = $self->_value_to_arrayitem
223            ('x-unknown' => $field, $self->{option});
224          push @{$self->{value}}, $value if $s;
225      }      }
226    }    }
227    $self;    $self;
228  }  }
229    
230  =item Message::Header->parse_array (\@header, [%initial-fields/options])  =item $msg = Message::Header->parse_array (\@header, [%initial-fields/options])
231    
232  Parses given C<header> and constructs a new C<Message::Headers>  Parses given C<header> and constructs a new C<Message::Headers>
233  object.  Same as C<Message::Header-E<lt>parse> but this method  object.  Same as C<Message::Header-E<lt>parse> but this method
# Line 380  sub parse_array ($\@;%) { Line 246  sub parse_array ($\@;%) {
246    $self->_init (@_);    $self->_init (@_);
247    while (1) {    while (1) {
248      my $field = shift @$header;      my $field = shift @$header;
249      while (1) {      if ($self->{option}->{use_folding}) {
250        if ($$header[0] =~ /^$REG{WSP}/) {        while (1) {
251          $field .= shift @$header;          if ($$header[0] =~ /^$REG{WSP}/) {
252        } else {last}            $field .= shift @$header;
253            } else {last}
254          }
255      }      }
256      if ($self->{option}->{linebreak_strict}) {      if ($self->{option}->{linebreak_strict}) {
257        $field =~ s/\x0D\x0A//g;        $field =~ s/\x0D\x0A//g;
258      } else {      } else {
259        $field =~ tr/\x0D\x0A//d;        $field =~ tr/\x0D\x0A//d;
260      }      }
261        local $self->{option}->{parse} = $self->{option}->{parse_all};
262      if ($field =~ /$REG{M_fromline}/) {      if ($field =~ /$REG{M_fromline}/) {
263        my $body = $1;        my ($s,undef,$value) = $self->_value_to_arrayitem
264        $body = $self->_field_body ($body, 'mail-from')          ('mail-from' => $1, $self->{option});
265          if $self->{option}->{parse_all};        push @{$self->{value}}, $value if $s;
       push @{$self->{field}}, {name => 'mail-from', body => $body};  
266      } elsif ($field =~ /$REG{M_field}/) {      } elsif ($field =~ /$REG{M_field}/) {
267        my ($name, $body) = (lc $1, $2);        my ($name, $body) = ($self->_n11n_field_name ($1), $2);
       $name =~ s/$REG{WSP}+$//;  
268        $body =~ s/$REG{WSP}+$//;        $body =~ s/$REG{WSP}+$//;
269        $body = $self->_field_body ($body, $name) if $self->{option}->{parse_all};        my ($s,undef,$value) = $self->_value_to_arrayitem
270        push @{$self->{field}}, {name => $name, body => $body};          ($name => $body, $self->{option});
271          push @{$self->{value}}, $value if $s;
272        } elsif (length $field) {
273          my ($s,undef,$value) = $self->_value_to_arrayitem
274            ('x-unknown' => $field, $self->{option});
275          push @{$self->{value}}, $value if $s;
276      }      }
277      last if $#$header < 0;      last if $#$header < 0;
278    }    }
# Line 420  context, only first one is returned.) Line 292  context, only first one is returned.)
292    
293  =cut  =cut
294    
295  sub field ($$) {  sub field ($@) {shift->SUPER::item (@_)}
296    sub field_exist ($@) {shift->SUPER::item_exist (@_)}
297    
298    ## item-by?, \$checked-item, {item-key => 1}, \%option
299    sub _item_match ($$\$\%\%) {
300    my $self = shift;    my $self = shift;
301    my $name = lc shift;    my ($by, $i, $list, $option) = @_;
302    my @ret;    return 0 unless ref $$i;  ## Already removed
303    for my $field (@{$self->{field}}) {    if ($by eq 'name') {
304      if ($field->{name} eq $name) {      my %o = %$option; $o{parse} = 0;
305        unless (wantarray) {      my %l;
306          $field->{body} = $self->_field_body ($field->{body}, $name);      for (keys %$list) {
307          return $field->{body};        my ($s, undef, $v) = $self->_value_to_arrayitem ($_, '', %o);
308          if ($s) {
309            $l{$v->{name} . ':' . ( $option->{ns} || $v->{ns} ) } = 1;
310        } else {        } else {
311          $field->{body} = $self->_field_body ($field->{body}, $name);          $l{$v->{name} .':'. ( $option->{ns} || $self->{option}->{ns_default_phuri} ) } = 1;
         push @ret, $field->{body};  
312        }        }
313      }      }
314    }      return 1 if $l{$$i->{name} . ':' . $$i->{ns}};
315    if ($#ret < 0) {    } elsif ($by eq 'ns') {
316      return $self->add ($name);      return 1 if $list->{ $$i->{ns} };
   }  
   @ret;  
 }  
   
 sub field_exist ($$) {  
   my $self = shift;  
   my $name = lc shift;  
   my @ret;  
   for my $field (@{$self->{field}}) {  
     return 1 if ($field->{name} eq $name);  
317    }    }
318    0;    0;
319  }  }
320    *_delete_match = \&_item_match;
321    
322  =head2 $self->field_name ($index)  ## Returns returned item value    \$item-value, \%option
323    sub _item_return_value ($\$\%) {
324  Returns C<field-name> of $index'th C<field>.    if (ref ${$_[1]}->{body}) {
325        ${$_[1]}->{body};
326  =head2 $self->field_body ($index)    } else {
327        ${$_[1]}->{body} = $_[0]->_parse_value (${$_[1]}->{name} => ${$_[1]}->{body},
328          ns => ${$_[1]}->{ns});
329        ${$_[1]}->{body};
330      }
331    }
332    *_add_return_value = \&_item_return_value;
333    *_replace_return_value = \&_item_return_value;
334    
335    ## Returns returned (new created) item value    $name, \%option
336    sub _item_new_value ($$\%) {
337        my ($s,undef,$value) = $_[0]->_value_to_arrayitem
338            ($_[1] => '', $_[2]);
339        $s? $value: undef;
340    }
341    
 Returns C<field-body> of $index'th C<field>.  
342    
 =cut  
343    
344  sub field_name ($$) {  ## $self->_parse_value ($type, $value, %options);
345    my $self = shift;  sub _parse_value ($$$;%) {
346    $self->{field}->[shift]->{name};    my $self = shift;
347  }    my $name = shift ;#|| $self->{option}->{_VALTYPE_DEFAULT};
348  sub field_body ($$) {    my $value = shift;  return $value if ref $value;
349    my $self = shift;    my %option = @_;
350    my $i = shift;    my $vtype; { no strict 'refs';
351    $self->{field}->[$i]->{body}      my $vt = ${&_NS_uri2phpackage ($option{ns}).'::OPTION'}{value_type};
352     = $self->_field_body ($self->{field}->[$i]->{body}, $self->{field}->[$i]->{name});      if (ref $vt) {
353    $self->{field}->[$i]->{body};        $vtype = $vt->{$name} || $vt->{$self->{option}->{_VALTYPE_DEFAULT}};
354        }
355        ## For compatiblity.
356        unless (ref $vtype) { $vtype = $self->{option}->{value_type}->{$name}
357          || $self->{option}->{value_type}->{$self->{option}->{_VALTYPE_DEFAULT}} }
358      }
359      my $vpackage = $vtype->[0];
360      my %vopt = %{$vtype->[1]} if ref $vtype->[1];
361      if ($vpackage eq ':none:') {
362        return $value;
363      } elsif (defined $value) {
364        eval "require $vpackage" or Carp::croak qq{<parse>: $vpackage: Can't load package: $@};
365        return $vpackage->parse ($value,
366          -format   => $self->{option}->{format},
367          -field_ns => $option{ns},
368          -field_name       => $name,
369        -header_default_charset     => $self->{option}->{header_default_charset},
370        -header_default_charset_input       => $self->{option}->{header_default_charset_input},
371          -parse_all        => $self->{option}->{parse_all},
372        %vopt);
373      } else {
374        eval "require $vpackage" or Carp::croak qq{<parse>: $vpackage: Can't load package: $@};
375        return $vpackage->new (
376          -format   => $self->{option}->{format},
377          -field_ns => $option{ns},
378          -field_name       => $name,
379        -header_default_charset     => $self->{option}->{header_default_charset},
380        -header_default_charset_input       => $self->{option}->{header_default_charset_input},
381          -parse_all        => $self->{option}->{parse_all},
382        %vopt);
383      }
384  }  }
385    
386  sub _field_body ($$$) {  ## Defined for text/rfc822-headers
387    my $self = shift;  sub entity_header ($;$) {
388    my ($body, $name) = @_;    my $self = shift;
389    unless (ref $body) {    my $new_header = shift;
390      my $type = $self->{option}->{field_type}->{$name}    if (ref $new_header) {
391              || $self->{option}->{field_type}->{':DEFAULT'};      $self->{header} = $new_header;
     eval "require $type" or Carp::croak ("_field_body: $type: $@");  
     unless ($body) {  
       $body = $type->new (-field_name => $name,  
         -format => $self->{option}->{format},  
         -parse_all => $self->{option}->{parse_all});  
     } else {  
       $body = $type->parse ($body, -field_name => $name,  
         -format => $self->{option}->{format},  
         -parse_all => $self->{option}->{parse_all});  
     }  
392    }    }
393    $body;    $self->{header};
394  }  }
395    
396  =head2 $self->field_name_list ()  =head2 $self->field_name_list ()
# Line 503  returns ALL names.) Line 403  returns ALL names.)
403    
404  sub field_name_list ($) {  sub field_name_list ($) {
405    my $self = shift;    my $self = shift;
406    $self->_delete_empty_field ();    $self->_delete_empty ();
407    map {$_->{name}} @{$self->{field}};    map { $_->{name} . ':' . $_->{ns} } @{$self->{value}};
408    }
409    
410    sub namespace_ph_default ($;$) {
411      my $self = shift;
412      if (defined $_[0]) {
413        no strict 'refs';
414        $self->{option}->{ns_default_phuri} = $_[0];
415        $self->_ns_load_ph (${&_NS_uri2phpackage ($self->{option}->{ns_default_phuri}).'::OPTION'}{namespace_phname});
416      }
417      $self->{option}->{ns_default_phuri};
418  }  }
419    
420  =item $hdr->add ($field-name, $field-body, [$name, $body, ...])  =item $hdr->add ($field-name, $field-body, [$name, $body, ...])
# Line 530  C<-validate>: Checks whether C<field-nam Line 440  C<-validate>: Checks whether C<field-nam
440    
441  =cut  =cut
442    
443  sub add ($%) {  ## [Name: Value] pair -> internal array item
444    my $self = shift;  ## $self->_value_to_arrayitem ($name => $value, {%options})
445    my %fields = @_;  ## or
446    my %option = %{$self->{option}};  ## $self->_value_to_arrayitem ($name => [$value, %value_options], {%options})
447    $option{parse} = 1 if defined wantarray;  ##
448    for (grep {/^-/} keys %fields) {$option{substr ($_, 1)} = $fields{$_}}  ## Return: ((1 = success / 0 = failue), $full_name, $arrayitem)
449    my $body;  sub _value_to_arrayitem ($$$\%) {
450    for (grep {/^[^-]/} keys %fields) {    my $self = shift;
451      my $name = lc $_;  $body = $fields{$_};    my ($name, $value, $option) = @_;
452      $name =~ tr/_/-/ if $option{translate_underscore};    my $value_option = {};
453      Carp::croak "add: $name: invalid field-name"    if (ref $value eq 'ARRAY') {
454        if $option{validate} && $name =~ /$REG{UNSAFE_field_name}/;      ($value, %$value_option) = @$value;
     $body = $self->_field_body ($body, $name) if $option{parse};  
     if ($option{prepend}) {  
       unshift @{$self->{field}}, {name => $name, body => $body};  
     } else {  
       push @{$self->{field}}, {name => $name, body => $body};  
     }  
455    }    }
456    $body if $option{parse};    my $nsuri = $self->{option}->{ns_default_phuri};
457      
458      no strict 'refs';
459      if ($value_option->{ns}) {
460        $nsuri = $value_option->{ns};
461      } elsif ($option->{ns}) {
462        $nsuri = $option->{ns};
463      } elsif ($name =~ s/^([Xx]-[A-Za-z]+|[A-Za-z]+)-//) {
464        my $oprefix = $1;
465        my $prefix
466          = &{${&_NS_uri2phpackage ($nsuri).'::OPTION'}{n11n_prefix}}
467            ($self, &_NS_uri2phpackage ($nsuri), $oprefix);
468        $self->_ns_load_ph ($prefix);
469        $nsuri = $self->{ns}->{phname2uri}->{$prefix};
470        unless ($nsuri) {
471          $name = $oprefix . '-' . $name;
472          $nsuri = $self->{option}->{ns_default_phuri};
473        }
474      }
475      $name
476        = &{${&_NS_uri2phpackage ($nsuri).'::OPTION'}{n11n_name}}
477          ($self, &_NS_uri2phpackage ($nsuri), $name);
478      Carp::croak "$name: invalid field-name"
479        if $option->{field_name_validation}
480          && $name =~ /$REG{$option->{field_name_unsafe_rule}}/;
481      $value = $self->_parse_value ($name => $value, ns => $nsuri)
482        if $$option{parse} || $$option{parse_all};
483      $$option{parse} = 0;
484      (1, $name.':'.$nsuri => {name => $name, body => $value, ns => $nsuri});
485  }  }
486    *_add_hash_check = \&_value_to_arrayitem;
487    *_replace_hash_check = \&_value_to_arrayitem;
488    
489  =head2 $self->relace ($field_name, $field_body)  =head2 $self->relace ($field_name, $field_body)
490    
# Line 562  first one is used and the others are not Line 496  first one is used and the others are not
496    
497  =cut  =cut
498    
499  sub replace ($%) {  sub _replace_hash_shift ($\%$\%) {
500    my $self = shift;    shift; my $r = shift;  my $n = $_[0]->{name} . ':' . $_[0]->{ns};
501    my %params = @_;    if ($$r{$n}) {
502    my %option = %{$self->{option}};      my $d = $$r{$n};
503    $option{parse} = defined wantarray unless defined $option{parse};      delete $$r{$n};
504    for (grep {/^-/} keys %params) {$option{substr ($_, 1)} = $params{$_}}      return $d;
   my (%new_field);  
   for (grep {/^[^-]/} keys %params) {  
     my $name = lc $_;  
     $name =~ tr/_/-/ if $option{translate_underscore};  
     Carp::croak "replace: $name: invalid field-name"  
       if $option{validate} && $name =~ /$REG{UNSAFE_field_name}/;  
     $params{$_} = $self->_field_body ($params{$_}, $name) if $option{parse};  
     $new_field{$name} = $params{$_};  
   }  
   my $body = (%new_field)[-1];  
   for my $field (@{$self->{field}}) {  
     if (defined $new_field{$field->{name}}) {  
       $field->{body} = $new_field {$field->{name}};  
       $new_field{$field->{name}} = undef;  
     }  
   }  
   for (keys %new_field) {  
     push @{$self->{field}}, {name => $_, body => $new_field{$_}};  
505    }    }
506    $body if $option{parse};    undef;
507  }  }
508    
509  =head2 $self->delete ($field-name, [$name, ...])  =head2 $self->delete ($field-name, [$name, ...])
# Line 596  Deletes C<field> named as $field_name. Line 512  Deletes C<field> named as $field_name.
512    
513  =cut  =cut
514    
 sub delete ($@) {  
   my $self = shift;  
   my %delete;  for (@_) {$delete{lc $_} = 1}  
   for my $field (@{$self->{field}}) {  
     undef $field if $delete{$field->{name}};  
   }  
 }  
515    
516  =head2 $self->count ([$field_name])  =head2 $self->count ([$field_name])
517    
# Line 612  of fields.  (Same as $#$self+1) Line 521  of fields.  (Same as $#$self+1)
521    
522  =cut  =cut
523    
524  sub count ($;$) {  sub _count_by_name ($$\%) {
525    my $self = shift;    my $self = shift;
526    my ($name) = (lc shift);    my ($array, $option) = @_;
527    unless ($name) {    my $name = $self->_n11n_field_name ($$option{-name});
528      $self->_delete_empty_field ();    my @a = grep {$_->{name} eq $name} @{$self->{$array}};
529      return $#{$self->{field}}+1;    $#a + 1;
530    }  }
531    my $count = 0;  
532    for my $field (@{$self->{field}}) {  ## Delete empty items
533      if ($field->{name} eq $name) {  sub _delete_empty ($) {
534        $count++;    my $self = shift;
535      }    my $array = $self->{option}->{_HASH_NAME};
536    }    $self->{$array} = [grep {ref $_ && length $_->{name}} @{$self->{$array}}];
   $count;  
537  }  }
538    
539  =head2 $self->rename ($field-name, $new-name, [$old, $new,...])  =head2 $self->rename ($field-name, $new-name, [$old, $new,...])
# Line 641  sub rename ($%) { Line 549  sub rename ($%) {
549    for (grep {/^-/} keys %params) {$option{substr ($_, 1)} = $params{$_}}    for (grep {/^-/} keys %params) {$option{substr ($_, 1)} = $params{$_}}
550    my %new_name;    my %new_name;
551    for (grep {/^[^-]/} keys %params) {    for (grep {/^[^-]/} keys %params) {
552      my ($old => $new) = (lc $_ => lc $params{$_});      my ($old => $new)
553          = ($self->_n11n_field_name ($_) => $self->_n11n_field_name ($params{$_}));
554        $old =~ tr/_/-/ if $option{translate_underscore};
555      $new =~ tr/_/-/ if $option{translate_underscore};      $new =~ tr/_/-/ if $option{translate_underscore};
556      Carp::croak "rename: $new: invalid field-name"      Carp::croak "rename: $new: invalid field-name"
557        if $option{validate} && $new =~ /$REG{UNSAFE_field_name}/;        if $option{field_name_validation}
558            && $new =~ /$REG{$option{field_name_unsafe_rule}}/;
559      $new_name{$old} = $new;      $new_name{$old} = $new;
560    }    }
561    for my $field (@{$self->{field}}) {    for my $field (@{$self->{value}}) {
562      if (length $new_name{$field->{name}}) {      if (length $new_name{$field->{name}}) {
563        $field->{name} = $new_name{$field->{name}};        $field->{name} = $new_name{$field->{name}};
564      }      }
# Line 665  for each value. Line 576  for each value.
576    
577  =cut  =cut
578    
579  sub scan ($&) {  sub _scan_sort ($\@\%) {
580    my ($self, $sub) = @_;    my $self = shift;
581      my ($array, $option) = @_;
582    my $sort;    my $sort;
583    $sort = \&_header_cmp if $self->{option}->{sort} eq 'good-practice';    $sort = \&_header_cmp if $option->{field_sort} eq 'good-practice';
584    $sort = {$a cmp $b} if $self->{option}->{sort} eq 'alphabetic';    $sort = {$a cmp $b} if $option->{field_sort} eq 'alphabetic';
585    my @field = @{$self->{field}};    return ( sort $sort @$array ) if ref $sort;
586    if (ref $sort) {    @$array;
587      @field = sort $sort @{$self->{field}};  }
588    }  
589    for my $field (@field) {  sub _n11n_field_name ($$) {
590      next if $field->{name} =~ /^_/;    no strict 'refs';
591      &$sub($field->{name} => $field->{body});    my $self = shift;
592    }    my $s = shift;
593      $s =~ s/^$REG{WSP}+//; $s =~ s/$REG{WSP}+$//;
594      $s = lc $s unless ${&_NS_uri2phpackage ($self->{option}->{ns_default_phuri}).'::OPTION'}{case_sensible};
595      $s;
596  }  }
597    
598  # Compare function which makes it easy to sort headers in the  # Compare function which makes it easy to sort headers in the
# Line 710  sub stringify ($;%) { Line 625  sub stringify ($;%) {
625    for (grep {/^-/} keys %params) {$option{substr ($_, 1)} = $params{$_}}    for (grep {/^-/} keys %params) {$option{substr ($_, 1)} = $params{$_}}
626    my @ret;    my @ret;
627    my $_stringify = sub {    my $_stringify = sub {
628        my ($name, $body) = (@_);      no strict 'refs';
629          my ($name, $body, $nsuri) = ($_[1]->{name}, $_[1]->{body}, $_[1]->{ns});
630        return unless length $name;        return unless length $name;
631        return if $option{mail_from} && $name eq 'mail-from';        return if $option{output_mail_from} && $name eq 'mail-from';
632        return if !$option{output_bcc} && ($name eq 'bcc' || $name eq 'resent-bcc');        return if !$option{output_bcc} && ($name eq 'bcc' || $name eq 'resent-bcc');
633          my $nspackage = &_NS_uri2phpackage ($nsuri);
634          my $oname;        ## Outputed field-name
635          my $prefix = ${$nspackage.'::OPTION'} {namespace_phname_goodcase}
636                    || $self->{ns}->{uri2phname}->{$nsuri};
637          $prefix = undef if $nsuri eq $self->{option}->{ns_default_phuri};
638          my $gc = ${$nspackage.'::OPTION'} {to_be_goodcase};
639          if (ref $gc) { $oname = &$gc ($self, $nspackage, $name, \%option) }
640          else { $oname = $name }
641          if ($prefix) { $oname = $prefix . '-' . $oname }
642        if ($option{format} =~ /uri-url-mailto/) {        if ($option{format} =~ /uri-url-mailto/) {
643          return if ((   $option{uri_mailto_safe}->{$name}          return if (( ${$nspackage.'::OPTION'} {uri_mailto_safe}->{$name}
644               || $option{uri_mailto_safe}->{':default'})                    || ${$nspackage.'::OPTION'} {uri_mailto_safe}->{':default'})
645                < $option{uri_mailto_safe_level});                    < $option{uri_mailto_safe_level});
646          if ($name eq 'to') {          if ($name eq 'to') {
647            $body = $self->field ('to');            $body = $self->field ('to', -new_item_unless_exist => 0);
648            return unless ref $body && $body->have_group;            if (ref $body && $body->have_group) {
649                #
650              } elsif (ref $body && $body->count > 1) {
651                $body = $body->clone;
652                $body->delete ({-by => 'index'}, 0);
653              }
654          }          }
655        }        }
656        my $fbody;        my $fbody;
# Line 737  sub stringify ($;%) { Line 667  sub stringify ($;%) {
667        } else {        } else {
668          $fbody =~ s/\x0D\x0A(?=[^\x09\x20])/\x0D\x0A\x20/g;          $fbody =~ s/\x0D\x0A(?=[^\x09\x20])/\x0D\x0A\x20/g;
669        }        }
670        if (ref $option{capitalize}) {        if ($option{use_folding}) {
671          $name = &{$option{capitalize}} ($self, $name);          if (ref $option{output_folding}) {
672        } elsif ($option{capitalize}) {            $fbody = &{$option{output_folding}} ($self, $fbody,
673          $name =~ s/((?:^|-)[a-z])/uc($1)/ge;              -initial_length => length ($oname) +2);
674        }          } elsif ($option{output_folding}) {
675        if (ref $option{fold}) {            $fbody = $self->_fold ($fbody, -initial_length => length ($oname) +2);
676          $fbody = &{$option{fold}} ($self, $fbody);          }
       } elsif ($option{fold}) {  
         $fbody = $self->_fold ($fbody);  
677        }        }
678        push @ret, sprintf $option{field_format_pattern}, $name, $fbody;        push @ret, sprintf $option{field_format_pattern}, $oname, $fbody;
679      };      };
680    if ($option{format} =~ /uri-url-mailto-to/) {    if ($option{format} =~ /uri-url-mailto/) {
681      if ($self->field_exist ('to')) {      if ($option{format} =~ /uri-url-mailto-to/) {
682        my $to = $self->field ('to');        my $to = $self->field ('to', -new_item_unless_exist => 0);
683        unless ($to->have_group) {        if ($to) {
684          my $fbody = $to->stringify (-format => $option{format});          unless ($to->have_group) {
685          return &{$option{fold}} ($self, $fbody);            my $fbody = $to->stringify (-format => $option{format}, -max => 1);
686              return &{$option{output_folding}} ($self, $fbody);
687            }
688        }        }
689          '';
690        } elsif ($option{format} =~ /uri-url-mailto-rfc1738/) {
691          my $to = $self->field ('to', -new_item_unless_exist => 0);
692          if ($to) {
693            my $fbody = $to->addr_spec (-format => $option{format});
694            return &{$option{output_folding}} ($self, $fbody);
695          }
696          '';
697        } else {
698          $self->scan ($_stringify);
699          my $ret = join ('&', @ret);
700          $ret;
701      }      }
     '';  
   } elsif ($option{format} =~ /uri-url-mailto/) {  
     $self->scan ($_stringify);  
     my $ret = join ('&', @ret);  
     $ret;  
702    } else {    } else {
703      if ($option{mail_from}) {      if ($option{output_mail_from}) {
704        my $fromline = $self->field ('mail-from');        my $fromline = $self->field ('mail-from', -new_item_unless_exist => 0);
705        push @ret, 'From '.$fromline if $fromline;        push @ret, 'From '.$fromline if $fromline;
706      }      }
707      $self->scan ($_stringify);      $self->scan ($_stringify);
708      my $ret = join ("\n", @ret);      my $ret = join ("\x0D\x0A", @ret);
709      $ret? $ret."\n": '';      $ret? $ret."\x0D\x0A": '';
710    }    }
711  }  }
712  *as_string = \&stringify;  *as_string = \&stringify;
# Line 786  sub option ($@) { Line 723  sub option ($@) {
723      return $self->{option}->{ shift (@_) };      return $self->{option}->{ shift (@_) };
724    }    }
725    while (my ($name, $value) = splice (@_, 0, 2)) {    while (my ($name, $value) = splice (@_, 0, 2)) {
     $name =~ s/^-//;  
726      $self->{option}->{$name} = $value;      $self->{option}->{$name} = $value;
727      if ($name eq 'format') {      if ($name eq 'format') {
728        for my $f (@{$self->{field}}) {        for my $f (@{$self->{field}}) {
# Line 798  sub option ($@) { Line 734  sub option ($@) {
734    }    }
735  }  }
736    
737  sub field_type ($$;$) {  sub field_type ($@) {shift->SUPER::value_type (@_)}
738    
739    ## $self->_fold ($string, %option = (-max, -initial_length(for field-name)) )
740    sub _fold ($$;%) {
741    my $self = shift;    my $self = shift;
742    my $field_name = shift;    my $string = shift;
743    my $new_field_type = shift;    my %option = @_;
744    if ($new_field_type) {    my $max = $self->{option}->{line_length_max};
745      $self->{option}->{field_type}->{$field_name} = $new_field_type;    $max = 20 if $max < 20;
746    }    
747    $self->{option}->{field_type}->{$field_name}    my $l = $option{-initial_length} || 0;
748    || $self->{option}->{field_type}->{':DEFAULT'};    $l += length $1 if $string =~ /^([^\x09\x20]+)/;
749      $string =~ s{([\x09\x20][^\x09\x20]+)}{
750        my $s = $1;
751        if (($l + length $s) > $max) {
752          $s = "\x0D\x0A\x20" . $s;
753          $l = 1 + length $s;
754        } else { $l += length $s }
755        $s;
756      }gex;
757      $string;
758  }  }
759    
760  sub _delete_empty_field ($) {  sub _ns_load_ph ($$) {
761    my $self = shift;    my $self = shift;
762    my @ret;    my $name = shift;     ## normalized prefix (without HYPHEN-MINUS)
763    for my $field (@{$self->{field}}) {    return if $self->{ns}->{phname2uri}->{$name};
764      push @ret, $field if $field->{name};    $self->{ns}->{phname2uri}->{$name} = $NS_phname2uri{$name};
765    }    return unless $self->{ns}->{phname2uri}->{$name};
766    $self->{field} = \@ret;    $self->{ns}->{uri2phname}->{$self->{ns}->{phname2uri}->{$name}} = $name;
   $self;  
767  }  }
768    
769  sub _fold ($$;$) {  sub _NS_uri2phpackage ($) {
770    my $self = shift;    $NS_uri2phpackage{$_[0]}
771    my $string = shift;    || $NS_uri2phpackage{$Message::Header::Default::OPTION{namespace_uri}};
   my $len = shift || $self->{option}->{fold_length};  
   $len = 60 if $len < 60;  
     
   ## This code is taken from Mail::Header 1.43 in MailTools,  
   ## by Graham Barr (Maintained by Mark Overmeer <mailtools@overmeer.net>).  
   my $max = int($len - 5);         # 4 for leading spcs + 1 for [\,\;]  
   my $min = int($len * 4 / 5) - 4;  
   my $ml = $len;  
     
   if (length($string) > $ml) {  
      #Split the line up  
      # first bias towards splitting at a , or a ; >4/5 along the line  
      # next split a whitespace  
      # else we are looking at a single word and probably don't want to split  
      my $x = "";  
      $x .= "$1\n "  
        while($string =~ s/^$REG{WSP}*(  
                           [^"]{$min,$max}?[\,\;]  
                           |[^"]{1,$max}$REG{WSP}  
                           |[^\s"]*(?:"[^"]*"[^\s"]*)+$REG{WSP}  
                           |[^\s"]+$REG{WSP}  
                           )  
                         //x);  
      $x .= $string;  
      $string = $x;  
      $string =~ s/(\A$REG{WSP}+|$REG{WSP}+\Z)//sog;  
      $string =~ s/\s+\n/\n/sog;  
   }  
   $string;  
772  }  }
773    
774  =head2 $self->clone ()  =head2 $self->clone ()
# Line 859  Returns a copy of Message::Header object Line 777  Returns a copy of Message::Header object
777    
778  =cut  =cut
779    
780  sub clone ($) {  ## Inhreited
   my $self = shift;  
   my $clone = new Message::Header;  
   for my $name (%{$self->{option}}) {  
     if (ref $self->{option}->{$name} eq 'HASH') {  
       $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};  
     }  
   }  
   for (@{$self->{field}}) {  
     $clone->add ($_->{name}, scalar $_->{body});  
   }  
   $clone;  
 }  
781    
782  =head1 NOTE  =head1 NOTE
783    

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.29

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24