1Text::vCard::AddressbooUks(e3r)Contributed Perl DocumentTaetxito:n:vCard::Addressbook(3)
2
3
4
6 Text::vCard::Addressbook - a package to parse, edit and create multiple
7 vCards (RFC 2426)
8
10 use Text::vCard::Addressbook;
11
12 my $address_book = Text::vCard::Addressbook->new({
13 'source_file' => '/path/to/address.vcf',
14 });
15
16 foreach my $vcard ($address_book->vcards()) {
17 print "Got card for " . $vcard->fullname() . "\n";
18 }
19
21 This package provides an API to reading / editing and creating multiple
22 vCards. A vCard is an electronic business card. This package has been
23 developed based on rfc2426.
24
25 You will find that many applications (Apple Address book, MS Outlook,
26 Evolution etc) can export and import vCards.
27
29 load()
30 use Text::vCard::Addressbook;
31
32 # Read in from a list of files
33 my $address_book = Text::vCard::Addressbook->load( ['foo.vCard', 'Addresses.vcf']);
34
35 This method will croak if it is unable to read in any of the files.
36
37 import_data()
38 $address_book->import_data($value);
39
40 This method imports data directly from a string.
41
42 new()
43 # Read in from just one file
44 my $address_book = Text::vCard::Addressbook->new({
45 'source_file' => '/path/to/address.vcf',
46 });
47
48 This method will croak if it is unable to read in the source_file.
49
50 # File already in a string
51 my $address_book = Text::vCard::Addressbook->new({
52 'source_text' => $source_text,
53 });
54
55 # Create a new address book
56 my $address_book = Text::vCard::Addressbook->new();
57
58 Looping through all vcards in an address book.
59
60 foreach my $vcard ($address_book->vcards()) {
61 $vcard->...;
62 }
63
65 add_vcard()
66 my $vcard = $address_book->add_vcard();
67
68 This method creates a new empty Text::vCard object, stores it in the
69 address book and return it so you can add data to it.
70
71 vcards()
72 my $vcards = $address_book->vcards();
73 my @vcards = $address_book->vcards();
74
75 This method returns a reference to an array or an array of vcards in
76 this address book. This could be an empty list if there are no entries
77 in the address book.
78
79 export()
80 my $vcf_file = $address_book->export()
81
82 This method returns the vcard data in the vcf file format.
83
84 Please note there is no validation, you must ensure that the correct
85 nodes (FN,N,VERSION) are already added to each vcard if you want to
86 comply with RFC 2426.
87
88 This might not escape the results correctly at the moment.
89
91 Leo Lapworth, LLAP@cuckoo.org
92
94 Copyright (c) 2003 Leo Lapworth. All rights reserved. This program is
95 free software; you can redistribute it and/or modify it under the same
96 terms as Perl itself.
97
99 The authors of Text::vFile::asData for making my life so much easier.
100
102 Text::vCard, Text::vCard::Node
103
104
105
106perl v5.12.0 2010-01-24 Text::vCard::Addressbook(3)