worthmine / Text-vCard-Precisely

Read, Write or Edit vCard 3.0 or 4.0 with perl
https://metacpan.org/pod/Text::vCard::Precisely
Other
3 stars 3 forks source link

VCARD V4, TEL, TEL-text-param missing #24

Closed michaelof closed 4 years ago

michaelof commented 4 years ago

親愛なるユキ,

(c) Google Translate :)

When passing tel types to vcards like this:

use strict;
use warnings;
use Encode qw(encode_utf8);

use Text::vCard::Precisely;
my $vc = Text::vCard::Precisely->new( version => '4.0' );

my $fn = "Först Last";
printf '%vX', $fn;
print "\n";
$vc->fn( $fn );

my @tels = ();
push @tels, { type => ['cell'], content => "+491234567890" } ;
push @tels, { type => ['voice','home'], content => "+499876543210" } ;
$vc->tel(\@tels);

$vc->as_file("teltypes.vcf");

I'm getting the following vcard:

BEGIN:VCARD
VERSION:4.0
FN:Först Last
TEL;VALUE=uri:tel:+491234567890
TEL;VALUE=uri:tel:+499876543210
END:VCARD

Means that any tel type information is not in the vcard. Following TEL section 6.4.1 in RFC 6350 https://tools.ietf.org/html/rfc6350#section-6.4.1

The property can include the parameter "TYPE" to specify intended use for the telephone number.  
The predefined values for the TYPE  parameter are:

 +-----------+-------------------------------------------------------+
   | Value     | Description                                           |
   +-----------+-------------------------------------------------------+
   | text      | Indicates that the telephone number supports text     |
   |           | messages (SMS).                                       |
   | voice     | Indicates a voice telephone number.                   |
   | fax       | Indicates a facsimile telephone number.               |
   | cell      | Indicates a cellular or mobile telephone number.      |
   | video     | Indicates a video conferencing telephone number.      |
   | pager     | Indicates a paging device telephone number.           |
   | textphone | Indicates a telecommunication device for people with  |
   |           | hearing or speech difficulties.                       |
   +-----------+-------------------------------------------------------+

Is this missing because not implemented by you, or did I maybe misunderstand something?

worthmine commented 4 years ago

WOW! you've mastered Markdown😂

In conclusion, this is a bug. I've certainly made those even if those disappear now.

worthmine commented 4 years ago

No, it's not a bug! just replace your code like s/type/types/g; I can add an alias that is treated as same. it has duplication for Moose's existing method name.

So, you have to type 'types'.

michaelof commented 4 years ago

Cool!

Works with

push @tels, { types => ['cell'], content => "+491234567890" } ;
push @tels, { types => ['voice','home'], content => "+499876543210" } ;

But I believe that we've a documentation issue here, as https://metacpan.org/pod/Text::vCard::Precisely#tel() says:

tel()

Accepts/returns an ArrayRef that looks like:

[
   { type => ['work'], content => '651-290-1234', preferred => 1 },
   { type => ['home'], content => '651-290-1111' },
]

"type", not "types", maybe a "typo"? :)

worthmine commented 4 years ago

It must be a typo. Thanks for pointing out!

michaelof commented 4 years ago

Seen in https://github.com/worthmine/Text-vCard-Precisely/blob/master/README.md that docs are updated. Maybe next time I could help here myself.

THANK YOU