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 |
196 |
my $class = shift; |
my $class = shift; |
197 |
my $header = shift; |
my $header = shift; |
198 |
my $self = bless {}, $class; |
my $self = bless {}, $class; |
199 |
$self->_init (@_); ## BUG: don't check linebreak_strict |
$self->_init (@_); |
200 |
$header =~ s/\x0D?\x0A$REG{WSP}/\x20/gos if $self->{option}->{use_folding}; |
if ($self->{option}->{linebreak_strict}) { |
201 |
|
$header =~ s/\x0D\x0A$REG{WSP}/\x20/gos if $self->{option}->{use_folding}; |
202 |
|
} else { |
203 |
|
$header =~ s/\x0D?\x0A$REG{WSP}/\x20/gos if $self->{option}->{use_folding}; |
204 |
|
} |
205 |
for my $field (split /\x0D?\x0A/, $header) { |
for my $field (split /\x0D?\x0A/, $header) { |
206 |
if ($field =~ /$REG{M_fromline}/) { |
if ($field =~ /$REG{M_fromline}/) { |
207 |
my ($s,undef,$value) = $self->_value_to_arrayitem |
my ($s,undef,$value) = $self->_value_to_arrayitem |
361 |
-format => $self->{option}->{format}, |
-format => $self->{option}->{format}, |
362 |
-field_ns => $option{ns}, |
-field_ns => $option{ns}, |
363 |
-field_name => $name, |
-field_name => $name, |
364 |
|
-header_default_charset => $self->{option}->{header_default_charset}, |
365 |
|
-header_default_charset_input => $self->{option}->{header_default_charset_input}, |
366 |
-parse_all => $self->{option}->{parse_all}, |
-parse_all => $self->{option}->{parse_all}, |
367 |
%vopt); |
%vopt); |
368 |
} else { |
} else { |
371 |
-format => $self->{option}->{format}, |
-format => $self->{option}->{format}, |
372 |
-field_ns => $option{ns}, |
-field_ns => $option{ns}, |
373 |
-field_name => $name, |
-field_name => $name, |
374 |
|
-header_default_charset => $self->{option}->{header_default_charset}, |
375 |
|
-header_default_charset_input => $self->{option}->{header_default_charset_input}, |
376 |
-parse_all => $self->{option}->{parse_all}, |
-parse_all => $self->{option}->{parse_all}, |
377 |
%vopt); |
%vopt); |
378 |
} |
} |
572 |
} |
} |
573 |
|
|
574 |
sub _n11n_field_name ($$) { |
sub _n11n_field_name ($$) { |
575 |
|
no strict 'refs'; |
576 |
my $self = shift; |
my $self = shift; |
577 |
my $s = shift; |
my $s = shift; |
578 |
$s =~ s/^$REG{WSP}+//; $s =~ s/$REG{WSP}+$//; |
$s =~ s/^$REG{WSP}+//; $s =~ s/$REG{WSP}+$//; |
730 |
$max = 20 if $max < 20; |
$max = 20 if $max < 20; |
731 |
|
|
732 |
my $l = $option{-initial_length} || 0; |
my $l = $option{-initial_length} || 0; |
733 |
$string =~ s{((?:^|[\x09\x20])[^\x09\x20]+)}{ |
$l += length $1 if $string =~ /^([^\x09\x20]+)/; |
734 |
|
$string =~ s{([\x09\x20][^\x09\x20]+)}{ |
735 |
my $s = $1; |
my $s = $1; |
736 |
if ($l + length $s > $max) { |
if (($l + length $s) > $max) { |
737 |
$s = "\x0D\x0A\x20" . $s; |
$s = "\x0D\x0A\x20" . $s; |
738 |
$l = length ($s) - 2; |
$l = 1 + length $s; |
739 |
} else { $l += length $s } |
} else { $l += length $s } |
740 |
$s; |
$s; |
741 |
}gex; |
}gex; |