Closed moznion closed 4 years ago
I think this is a good idea, but am not adding it just as provided, yet. There are (awful) rules about forming content type strings, and I'd like to take some time to get it right. I'll leave this ticket open, though.
Please don't delete the gist, in case I give up on RFC compliance. ;)
Thanks!
I'm just bringing the gist content in here. "please don't delete the gist" is silly.
sub build_content_type {
my ($self, $content_type) = @_;
if (!$content_type->{discrete} || !$content_type->{composite}) {
die "! Invalid Content-Type";
}
my $content_type_str = "$content_type->{discrete}/$content_type->{composite}";
for my $k (keys %{$content_type->{attributes}}) {
my $v = $content_type->{attributes}->{$k};
next unless $v;
$content_type_str .= ";$k=$v";
}
return $content_type_str;
}
Notes for the future:
$self
type
and subtype
not discrete
and composite
Should be fun.
Another problems:
tspecials
charactersI tried to implement function build_content_type correctly according to RFC 2045 and RFC 2231. Code is in pull request https://github.com/rjbs/Email-MIME-ContentType/pull/11. So please review & test.
Can somebody review or test my code in pull request? Now it is year since I opened that pull request. Is still somebody interested in it?
second this! thanks @pali
Thank you so much for this!
Hello,
When this module had construction method for Content-Type which takes result of
parse_content_type()
as the argument, I thought that it was convenient.Like so (Since it wrote promptly, there may be a point that something is not good); https://gist.github.com/moznion/7496660
Since this processing can be written easily, a user may actually be what to write individually. However, I thought that the way which offered unific processing was good because it doesn't make trifling difference (e.g. treatment of white space, etc...) will not be induced.