/[suikacvs]/test/cvs
Suika

Diff of /test/cvs

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

revision 1.26 by wakaba, Sun Jun 16 10:45:54 2002 UTC revision 1.29 by wakaba, Wed Jul 3 23:39:15 2002 UTC
# Line 35  push @ISA, qw(Message::Field::Structured Line 35  push @ISA, qw(Message::Field::Structured
35      -field_format_pattern       => '%s: %s',      -field_format_pattern       => '%s: %s',
36      -field_name_case_sensible   => 0,      -field_name_case_sensible   => 0,
37      -field_name_unsafe_rule     => 'NON_ftext',      -field_name_unsafe_rule     => 'NON_ftext',
38      -field_name_validation      => 1,   ## Method level option.      -field_name_validation      => 0,
39      -field_sort => 0,      -field_sort => 0,
40      #-format    => 'mail-rfc2822',      #-format    => 'mail-rfc2822',
41        -header_default_charset     => 'iso-2022-int-1',
42        -header_default_charset_input       => 'iso-2022-int-1',
43      -linebreak_strict   => 0,   ## Not implemented completely      -linebreak_strict   => 0,   ## Not implemented completely
44      -line_length_max    => 60,  ## For folding      -line_length_max    => 60,  ## For folding
45      #ns_default_phuri      #ns_default_phuri
# Line 126  sub _init ($;%) { Line 128  sub _init ($;%) {
128    $self->{option}->{ns_default_phuri} = $self->{ns}->{phname2uri}->{'rfc822'}    $self->{option}->{ns_default_phuri} = $self->{ns}->{phname2uri}->{'rfc822'}
129      unless $self->{option}->{ns_default_phuri};      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      unless (substr ($name, 0, 1) eq '-') {      unless (substr ($name, 0, 1) eq '-') {
# Line 194  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 if $self->{option}->{use_folding};    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 ($s,undef,$value) = $self->_value_to_arrayitem        my ($s,undef,$value) = $self->_value_to_arrayitem
# Line 355  sub _parse_value ($$$;%) { Line 366  sub _parse_value ($$$;%) {
366        -format   => $self->{option}->{format},        -format   => $self->{option}->{format},
367        -field_ns => $option{ns},        -field_ns => $option{ns},
368        -field_name       => $name,        -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},        -parse_all        => $self->{option}->{parse_all},
372      %vopt);      %vopt);
373    } else {    } else {
# Line 363  sub _parse_value ($$$;%) { Line 376  sub _parse_value ($$$;%) {
376        -format   => $self->{option}->{format},        -format   => $self->{option}->{format},
377        -field_ns => $option{ns},        -field_ns => $option{ns},
378        -field_name       => $name,        -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},        -parse_all        => $self->{option}->{parse_all},
382      %vopt);      %vopt);
383    }    }
384  }  }
385    
386    ## Defined for text/rfc822-headers
387    sub entity_header ($;$) {
388      my $self = shift;
389      my $new_header = shift;
390      if (ref $new_header) {
391        $self->{header} = $new_header;
392      }
393      $self->{header};
394    }
395    
396  =head2 $self->field_name_list ()  =head2 $self->field_name_list ()
397    
398  Returns list of all C<field-name>s.  (Even if there are two  Returns list of all C<field-name>s.  (Even if there are two
# Line 562  sub _scan_sort ($\@\%) { Line 587  sub _scan_sort ($\@\%) {
587  }  }
588    
589  sub _n11n_field_name ($$) {  sub _n11n_field_name ($$) {
590      no strict 'refs';
591    my $self = shift;    my $self = shift;
592    my $s = shift;    my $s = shift;
593    $s =~ s/^$REG{WSP}+//; $s =~ s/$REG{WSP}+$//;    $s =~ s/^$REG{WSP}+//; $s =~ s/$REG{WSP}+$//;
# Line 719  sub _fold ($$;%) { Line 745  sub _fold ($$;%) {
745    $max = 20 if $max < 20;    $max = 20 if $max < 20;
746        
747    my $l = $option{-initial_length} || 0;    my $l = $option{-initial_length} || 0;
748    $string =~ s{((?:^|[\x09\x20])[^\x09\x20]+)}{    $l += length $1 if $string =~ /^([^\x09\x20]+)/;
749      $string =~ s{([\x09\x20][^\x09\x20]+)}{
750      my $s = $1;      my $s = $1;
751      if ($l + length $s > $max) {      if (($l + length $s) > $max) {
752        $s = "\x0D\x0A\x20" . $s;        $s = "\x0D\x0A\x20" . $s;
753        $l = length ($s) - 2;        $l = 1 + length $s;
754      } else { $l += length $s }      } else { $l += length $s }
755      $s;      $s;
756    }gex;    }gex;

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24