43 |
my $self = shift; |
my $self = shift; |
44 |
my %options = @_; |
my %options = @_; |
45 |
my %DEFAULT = ( |
my %DEFAULT = ( |
46 |
|
-_ARRAY_NAME => 'value', |
47 |
#encoding_after_encode |
#encoding_after_encode |
48 |
#encoding_before_decode |
#encoding_before_decode |
49 |
-field_name => 'keywords', |
-field_name => 'keywords', |
75 |
list-owner list- list-post list- list-subscribe list- |
list-owner list- list-post list- list-subscribe list- |
76 |
list-unsubscribe list- list-url list- uri 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-daughter x-moe x-dearfriend x-moe |
x-brother x-moe x-boss x-moe x-classmate x-moe x-daughter x-moe |
79 |
|
x-dearfriend x-moe |
80 |
x-favoritesong x-moe |
x-favoritesong x-moe |
81 |
x-friend x-moe x-me x-moe |
x-friend x-moe x-me x-moe |
82 |
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); |
204 |
|
|
205 |
Adds (appends) new value(s). |
Adds (appends) new value(s). |
206 |
|
|
|
=iterm $csv->prepend ($value1, [$value2, $value3,...]) |
|
|
|
|
|
Prepends new value(s). |
|
|
|
|
207 |
=cut |
=cut |
208 |
|
|
209 |
sub add ($@) { |
sub _add_array_check ($$\%) { |
|
my $self = shift; |
|
|
push @{$self->{value}}, @_; |
|
|
} |
|
|
|
|
|
sub prepend ($@) { |
|
210 |
my $self = shift; |
my $self = shift; |
211 |
unshift @{$self->{value}}, @_; |
my ($value, $option) = @_; |
212 |
|
my $value_option = {}; |
213 |
|
if (ref $value eq 'ARRAY') { |
214 |
|
($value, %$value_option) = @$value; |
215 |
|
} |
216 |
|
(1, value => $value); |
217 |
} |
} |
218 |
|
|
219 |
=item $field-body = $csv->stringify () |
=item $field-body = $csv->stringify () |
234 |
$option{separator} = $option{separator_long} |
$option{separator} = $option{separator_long} |
235 |
if $option{max} >= $option{long_count}; |
if $option{max} >= $option{long_count}; |
236 |
join $option{separator}, |
join $option{separator}, |
237 |
map { |
map {$self->_stringify_item ($_, \%option)} @{$self->{value}}[0..$option{max}]; |
238 |
if ($option{is_quoted_string}) { |
} |
239 |
my %s = &{$self->{option}->{hook_encode_string}} ($self, |
*as_string = \&stringify; |
240 |
$_, type => 'phrase'); |
|
241 |
|
sub _stringify_item ($$\%) { |
242 |
|
my $self = shift; |
243 |
|
my $item = shift; |
244 |
|
my $option = shift; |
245 |
|
if ($$option{is_quoted_string}) { |
246 |
|
my %s = &{$$option{hook_encode_string}} ($self, |
247 |
|
$item, type => 'phrase'); |
248 |
Message::Util::quote_unsafe_string ($s{value}, |
Message::Util::quote_unsafe_string ($s{value}, |
249 |
unsafe => $option{value_unsafe_rule}); |
unsafe => $$option{value_unsafe_rule}); |
250 |
} else { |
} else { |
251 |
$_; |
$item; |
252 |
} |
} |
|
} @{$self->{value}}[0..$option{max}]; |
|
253 |
} |
} |
|
*as_string = \&stringify; |
|
254 |
|
|
255 |
=item $option-value = $ua->option ($option-name) |
=item $option-value = $ua->option ($option-name) |
256 |
|
|