ranguard / text-vcard

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

1 instead of Type #27

Closed suuuper closed 10 years ago

suuuper commented 10 years ago

Hi,

i wirte this simple script: use Text::vCard::Addressbook; my $addressbook = new Text::vCard::Addressbook(); my $vcard = $addressbook->add_vcard(); $vcard->version('3.0'); $vcard->fullname("My Name"); my $mail_node = $vcard->add_node({'node_type' => 'EMAIL'}); $mail_node->add_types('INTERNET'); $mail_node->value( "john\@example.org" ); print $addressbook->export();

But my output is: BEGIN:VCARD VERSION:3.0 FN:My Name EMAIL;1=internet:john@example.org END:VCARD

There is 1 in EMAIL attribute nstead of TYPE=

suuuper commented 10 years ago

If i run the same plugin with $VERSION = '2.07'; it wokrs.

kablamo commented 10 years ago

I get the same output with the above code using version 2.07.

You definitely found a bug though. I'll take a look. I can duplicate it.

I recommend trying vCard instead of Text::vCard?

kablamo commented 10 years ago

If vCard doesn't have enough functionality for you though try something like this:

$value = "john@example.org";
$params = [{ type => 'internet' }];
$vcard->add_node(
    {   node_type => 'EMAIL',
        data      => [ { params => $params, value => $value } ],
    }
);
kablamo commented 10 years ago

@suuuper, this is fixed now in the master branch. It will be going to CPAN soon.