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

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

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

revision 1.11 by wakaba, Thu May 16 11:43:40 2002 UTC revision 1.12 by wakaba, Sun Jun 9 11:08:27 2002 UTC
# Line 60  sub _init ($;%) { Line 60  sub _init ($;%) {
60      -remove_comment     => 1,      -remove_comment     => 1,
61      -separator  => ', ',      -separator  => ', ',
62      -separator_long     => ', ',      -separator_long     => ', ',
63        -use_comment        => 1,
64      -max        => 0,      -max        => 0,
65      #value_type      #value_type
66      -value_unsafe_rule  => 'NON_http_token_wsp',      -value_unsafe_rule  => 'NON_http_token_wsp',
# Line 72  sub _init ($;%) { Line 73  sub _init ($;%) {
73  ## Accept: text/html; q=1.0, text/plain; q=0.03; *; q=0.01  ## Accept: text/html; q=1.0, text/plain; q=0.03; *; q=0.01
74    
75    my %field_type = qw(accept-charset accept accept-encoding accept    my %field_type = qw(accept-charset accept accept-encoding accept
76       accept-language accept       accept-language accept followup-to newsgroups
      content-language keywords  
      followup-to newsgroups  
      list-archive list- list-digest list- list-help list-  
      list-owner list- list-post list- list-subscribe list-  
      list-unsubscribe list- list-url list- uri list-  
77       posted-to newsgroups       posted-to newsgroups
78       x-brother x-moe x-boss x-moe x-classmate x-moe x-daughter x-moe       x-brother x-moe x-boss x-moe x-classmate x-moe x-daughter x-moe
79       x-dearfriend x-moe       x-dearfriend x-moe x-favoritesong x-moe
      x-favoritesong x-moe  
80       x-friend x-moe x-me x-moe       x-friend x-moe x-me x-moe
81       x-respect x-moe x-sister x-moe x-son x-moe x-sublimate x-moe x-wife x-moe);       x-respect x-moe x-sister x-moe x-son x-moe x-sublimate x-moe x-wife x-moe);
82    my $field_name = lc $self->{option}->{field_name};    my $field_name = $self->{option}->{field_name};
83    $field_name = $field_type{$field_name} || $field_name;    $field_name = $field_type{$field_name} || $field_name;
84    if ($field_name eq 'newsgroups') {    if ($field_name eq 'newsgroups') {
85      $self->{option}->{separator} = ',';      $self->{option}->{separator} = ',';
# Line 103  sub _init ($;%) { Line 98  sub _init ($;%) {
98    } elsif ($field_name eq 'accept') {    } elsif ($field_name eq 'accept') {
99      $self->{option}->{is_quoted_string} = 0;      $self->{option}->{is_quoted_string} = 0;
100      $self->{option}->{value_type}->{'*default'} = ['Message::Field::ValueParams'];      $self->{option}->{value_type}->{'*default'} = ['Message::Field::ValueParams'];
101    } elsif ($field_name eq 'list-') {    } elsif ($self->{option}->{field_ns} eq $Message::Header::NS_phname2uri{list}) {
102        $self->{option}->{is_quoted_string} = 0;
103        $self->{option}->{remove_comment} = 0;
104        $self->{option}->{value_type}->{'*default'} = ['Message::Field::URI'];
105      } elsif ($field_name eq 'uri') {
106      $self->{option}->{is_quoted_string} = 0;      $self->{option}->{is_quoted_string} = 0;
107      $self->{option}->{remove_comment} = 0;      $self->{option}->{remove_comment} = 0;
108      $self->{option}->{value_type}->{'*default'} = ['Message::Field::URI'];      $self->{option}->{value_type}->{'*default'} = ['Message::Field::URI'];
# Line 144  sub parse ($$;%) { Line 143  sub parse ($$;%) {
143    my $field_body = shift;    my $field_body = shift;
144    $self->_init (@_);    $self->_init (@_);
145    $field_body = Message::Util::delete_comment ($field_body)    $field_body = Message::Util::delete_comment ($field_body)
146      if $self->{option}->{remove_comment};      if $self->{option}->{use_comment} && $self->{option}->{remove_comment};
147    push @{$self->{value}}, $self->_parse_list ($field_body);    push @{$self->{value}}, $self->_parse_list ($field_body);
148    $self;    $self;
149  }  }
# Line 233  sub stringify ($;%) { Line 232  sub stringify ($;%) {
232    for (grep {/^-/} keys %o) {$option{substr ($_, 1)} = $o{$_}}    for (grep {/^-/} keys %o) {$option{substr ($_, 1)} = $o{$_}}
233    $self->_delete_empty;    $self->_delete_empty;
234    $option{max}--;    $option{max}--;
235    $option{max} = $#{$self->{value}} if $option{max} <= 0;    $option{max} = $#{$self->{value}} if $option{max} < 0;
236    $option{max} = $#{$self->{value}} if $#{$self->{value}} < $option{max};    $option{max} = $#{$self->{value}} if $#{$self->{value}} < $option{max};
237    $option{separator} = $option{separator_long}    $option{separator} = $option{separator_long}
238      if $option{max} >= $option{long_count};      if $option{max} >= $option{long_count};

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24