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

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

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

revision 1.10 by wakaba, Tue May 14 13:42:40 2002 UTC revision 1.11 by wakaba, Sun Jun 9 11:08:28 2002 UTC
# Line 77  sub _init ($;%) { Line 77  sub _init ($;%) {
77    );    );
78    $self->SUPER::_init (%DEFAULT, %options);    $self->SUPER::_init (%DEFAULT, %options);
79    $self->{param} = [];    $self->{param} = [];
80    my $fname = $self->_n11n_field_name ($self->{option}->{field_name});    my $fname = $self->{option}->{field_name};
81    if ($fname eq 'p3p') {    if ($fname eq 'p3p') {
82      $self->{option}->{parameter_rule} = 'param_nocomma';      $self->{option}->{parameter_rule} = 'param_nocomma';
83      $self->{option}->{separator} = ', ';      $self->{option}->{separator} = ', ';
# Line 219  sub _restore_param ($@) { Line 219  sub _restore_param ($@) {
219    @ret;    @ret;
220  }  }
221    
222    ## $self->_save_param (@parameters)
223    ## --- Save parameter values to $self
224  sub _save_param ($@) {  sub _save_param ($@) {
225    my $self = shift;    my $self = shift;
226    my @p = map {## TODO: BUG:    my @p = @_;
227      if ($self->{option}->{parse_all} && $_->[1]->{is_parameter}) {    $self->_parse_param_value (\@p) if $self->{option}->{parse_all};
       $_->[1]->{value} = $self->_parse_value ($_->[0] => $_->[1]->{value});  
     }  
     $_;  
   } @_;  
228    $self->{param} = \@p;    $self->{param} = \@p;
229    $self;    $self;
230  }  }
231  *__save_param = \&_save_param;  ## SHOULD NOT BE OVERRIDDEN!  *__save_param = \&_save_param;  ## SHOULD NOT BE OVERRIDDEN!
232    
233    ## $self->_parse_param_value (\@parameters)
234    ## --- Parse each values of parameters
235    sub _parse_param_value ($\@) {
236      my $self = shift;
237      my $p = shift;
238      @$p = map {
239        if ($_->[1]->{is_parameter}) {
240          $_->[1]->{value} = $self->_parse_value ($_->[0] => $_->[1]->{value});
241        }
242        $_;
243      } @$p;
244      #$p;
245    }
246    
247  =back  =back
248    
249  =head1 METHODS  =head1 METHODS
# Line 390  sub parameter_value ($$;$) { Line 402  sub parameter_value ($$;$) {
402    
403  sub _delete_empty ($) {  sub _delete_empty ($) {
404    my $self = shift;    my $self = shift;
405    $self->{param} = [grep {length $_} @{$self->{param}}];    $self->{param} = [grep {ref $_} @{$self->{param}}];
406  }  }
407    
408    
# Line 417  sub stringify ($;%) { Line 429  sub stringify ($;%) {
429          my (%e) = &{$self->{option}->{hook_encode_string}} ($self,          my (%e) = &{$self->{option}->{hook_encode_string}} ($self,
430            $v->{value}, current_charset => $v->{charset}, language => $v->{language},            $v->{value}, current_charset => $v->{charset}, language => $v->{language},
431            type => 'parameter');            type => 'parameter');
432          if ($e{value} eq undef) {          if (!defined $e{value}) {
433            $value[0] = undef;            $value[0] = undef;
434          } elsif ($option{use_parameter_extension} && ($e{charset} || $e{language}          } elsif ($option{use_parameter_extension} && ($e{charset} || $e{language}
435                             || $e{value} =~ /[\x00\x0D\x0A\x80-\xFF]/)) {                             || $e{value} =~ /[\x00\x0D\x0A\x80-\xFF]/)) {
# Line 473  sub stringify ($;%) { Line 485  sub stringify ($;%) {
485            for my $i (0..$#value) {            for my $i (0..$#value) {
486              push @new, $name.'*'.$i.($encoded?'*':'').'='.$value[$i];              push @new, $name.'*'.$i.($encoded?'*':'').'='.$value[$i];
487            }            }
488            $new = join '; ', @new;            $new = join $self->{option}->{separator}, @new;
489          }          }
490        } else {        } else {
491          my %e = &{$self->{option}->{hook_encode_string}} ($self,          my %e = &{$self->{option}->{hook_encode_string}} ($self,
# Line 481  sub stringify ($;%) { Line 493  sub stringify ($;%) {
493          $new = Message::Util::quote_unsafe_string ($e{value},          $new = Message::Util::quote_unsafe_string ($e{value},
494            unsafe => 'NON_http_token_wsp');            unsafe => 'NON_http_token_wsp');
495        }        }
496        push @ret, $new;        push @ret, $new if length $new;
497    });    });
498    join $self->{option}->{separator}, @ret;    join $self->{option}->{separator}, @ret;
499  }  }

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24