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

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

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

revision 1.1 by wakaba, Sat Mar 23 11:41:36 2002 UTC revision 1.2 by wakaba, Mon Mar 25 10:15:26 2002 UTC
# Line 23  $VERSION=do{my @r=(q$Revision$=~/\d+/g); Line 23  $VERSION=do{my @r=(q$Revision$=~/\d+/g);
23  %DEFAULT = (  %DEFAULT = (
24    use_parameter_extension       => 1,    use_parameter_extension       => 1,
25    value_default => '',    value_default => '',
26    value_no_regex        => qr/(?:$)(?:^)/,    value_no_regex        => qr/(?!)/,
27    value_regex   => qr/[\x00-\xFF]+/,    value_regex   => qr/[\x00-\xFF]+/,
28      value_unsafe_rule     => 'NON_token_wsp',
29    value_type    => {'*DEFAULT'  => ':none:',    value_type    => {'*DEFAULT'  => ':none:',
30    },    },
31  );  );
# Line 153  An alias of C<stringify>. Line 154  An alias of C<stringify>.
154  sub stringify ($;%) {  sub stringify ($;%) {
155    my $self = shift;    my $self = shift;
156    my $param = $self->SUPER::stringify (@_);    my $param = $self->SUPER::stringify (@_);
157    $self->value ().($param? '; '.$param: '');    $self->value_as_string (@_).($param? '; '.$param: '');
158  }  }
159    
160  =head2 $self->value ([$new_value])  =head2 $self->value ([$new_value])
# Line 162  Returns or set value. Line 163  Returns or set value.
163    
164  =cut  =cut
165    
166  sub value ($;$) {  sub value ($;$%) {
167    my $self = shift;    my $self = shift;
168    my $new_value = shift;    my $new_value = shift;
169      my %option = @_;
170    if ($new_value && $new_value !~ m#$self->{option}->{value_no_regex}#) {    if ($new_value && $new_value !~ m#$self->{option}->{value_no_regex}#) {
171      $self->{value} = $new_value;      $self->{value} = $new_value;
172    }    }
173    $self->_quote_unsafe_string ($self->{value});    #my $unsafe_rule = $option{unsafe_rule} || $self->{option}->{value_unsafe_rule};
174      #$self->_quote_unsafe_string ($self->{value}, unsafe => $unsafe_rule);
175      $self->{value};
176    }
177    
178    =head2 $self->value_as_string ([%options])
179    
180    Returns value.  If necessary, quoted and encoded in
181    message format.  Same as C<stringify> except that
182    only first "value" is outputed.
183    
184    =cut
185    
186    sub value_as_string ($;%) {
187      my $self = shift;
188      my %option = @_;
189      my (%e) = &{$self->{option}->{hook_encode_string}} ($self,
190              $self->{value}, type => 'phrase');
191      my $unsafe_rule = $option{unsafe_rule} || $self->{option}->{value_unsafe_rule};
192      $self->_quote_unsafe_string ($e{value}, unsafe => $unsafe_rule);
193  }  }
194    
195    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24