ranguard / text-vcard

Perl package to edit and create vCard(s) (RFC 2426)
22 stars 15 forks source link

export leaves off final \r\n #4

Closed ysth closed 11 years ago

ysth commented 11 years ago

Text::vCard::Addressbook's export method should produce a trailing \r\n (when there are any vcards) but doesn't:

$ perl
use strict; use warnings; use Text::vCard::Addressbook; use Data::Dumper;
my $ab=Text::vCard::Addressbook->new();
$_->fullname("Foo"),$_->version("4.0") for $ab->add_vcard;
$_->fullname("Bar"),$_->version("4.0") for $ab->add_vcard;
print Data::Dumper->new([$ab->export])->Useqq(1)->Terse(1)->Dump
__END__

"BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Foo\r\nEND:VCARD\r\nBEGIN:VCARD\r\nVERSION:4.0\r\nFN:Bar\r\nEND:VCARD"

The division between RFC2425 and RFC2426 makes it unclear to me whether this is valid there, but under the newer combined RFC6350 it is definitely not valid - every END:VCARD must be followed by \r\n.