.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Text::vCard::Addressbook 3pm" .TH Text::vCard::Addressbook 3pm "2016-10-24" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Text::vCard::Addressbook \- Parse, edit, and create vCard address books (RFC 2426) .SH "WARNING" .IX Header "WARNING" vCard::AddressBook is built on top of this module and provides a more intuitive user interface. Please try that module first. .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Text::vCard::Addressbook; \& \& # To read an existing address book file: \& \& my $address_book = Text::vCard::Addressbook\->new({ \& \*(Aqsource_file\*(Aq => \*(Aq/path/to/address_book.vcf\*(Aq, \& }); \& \& foreach my $vcard ( $address_book\->vcards() ) { \& print "Got card for " . $vcard\->fullname() . "\en"; \& } \& \& # To create a new address book file: \& \& my $address_book = Text::vCard::Addressbook\->new(); \& my $vcard = $address_book\->add_vcard; \& $vcard\->fullname(\*(AqFoo Bar\*(Aq); \& $vcard\->EMAIL(\*(Aqfoo@bar.com\*(Aq); \& \& open my $out, \*(Aq>:encoding(UTF\-8)\*(Aq, \*(Aqnew_address_book.vcf\*(Aq or die; \& print $out $address_book\->export; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This package provides an \s-1API\s0 to reading / editing and creating multiple vCards. A vCard is an electronic business card. This package has been developed based on rfc2426. .PP You will find that many applications (Apple Address book, \s-1MS\s0 Outlook, Evolution etc) can export and import vCards. .SH "ENCODING AND UTF\-8" .IX Header "ENCODING AND UTF-8" .SS "Constructor Arguments" .IX Subsection "Constructor Arguments" The 'encoding_in' and 'encoding_out' constructor arguments allow you to read and write vCard files with any encoding. Examples of valid values are \&'\s-1UTF\-8\s0', 'Latin1', and 'none'. .PP Both values default to '\s-1UTF\-8\s0' and this should just work for the vast majority of people. The latest vCard \s-1RFC 6350\s0 only allows \s-1UTF\-8\s0 as an encoding so most people should not need to use either of these constructor arguments. .SS "\s-1MIME\s0 encodings" .IX Subsection "MIME encodings" vCard \s-1RFC 6350\s0 only allows \s-1UTF\-8\s0 but it still permits 8bit \s-1MIME\s0 encoding schemes such as Quoted-Printable and Base64 which are supported by this module. .SS "Manually setting values on a Text::vCard or Text::vCard::Node object" .IX Subsection "Manually setting values on a Text::vCard or Text::vCard::Node object" If you manually set values on a Text::vCard or Text::vCard::Node object they must be decoded values. The only exception to this rule is if you are messing around with the 'encoding_out' constructor arg. .SH "METHODS FOR LOADING VCARDS" .IX Header "METHODS FOR LOADING VCARDS" .SS "\fIload()\fP" .IX Subsection "load()" .Vb 3 \& my $address_book = Text::vCard::Addressbook\->load( \& [ \*(Aqfoo.vCard\*(Aq, \*(AqAddresses.vcf\*(Aq ], # list of files to load \& ); .Ve .PP This method will croak if it is unable to read in any of the files. .SS "\fIimport_data()\fP" .IX Subsection "import_data()" .Vb 1 \& $address_book\->import_data($string); .Ve .PP This method imports data directly from a string. \f(CW$string\fR is assumed to be decoded (but not \s-1MIME\s0 decoded). .SS "\fInew()\fP" .IX Subsection "new()" .Vb 2 \& # Create a new (empty) address book \& my $address_book = Text::vCard::Addressbook\->new(); \& \& # Load vcards from a single file \& my $address_book = Text::vCard::Addressbook\->new({ \& source_file => \*(Aq/path/to/address_book.vcf\*(Aq \& }); \& \& # Load vcards from a a string \& my $address_book = Text::vCard::Addressbook\->new({ \& source_text => $source_text \& }); .Ve .PP This method will croak if it is unable to read the source_file. .PP The constructor accepts 'encoding_in' and 'encoding_out' attributes. The default values for both are '\s-1UTF\-8\s0'. You can set them to 'none' if you don't want your output encoded with \fIEncode::encode()\fR. But be aware the latest vCard \s-1RFC 6350\s0 mandates \s-1UTF\-8.\s0 .SH "OTHER METHODS" .IX Header "OTHER METHODS" .SS "\fIadd_vcard()\fP" .IX Subsection "add_vcard()" .Vb 1 \& my $vcard = $address_book\->add_vcard(); .Ve .PP This method creates a new empty Text::vCard object, stores it in the address book and return it so you can add data to it. .SS "\fIvcards()\fP" .IX Subsection "vcards()" .Vb 2 \& my $vcards = $address_book\->vcards(); \& my @vcards = $address_book\->vcards(); .Ve .PP This method returns a reference to an array or an array of vcards in this address book. This could be an empty list if there are no entries in the address book. .SS "\fIset_encoding()\fP" .IX Subsection "set_encoding()" \&\s-1DEPRECATED. \s0 Use the 'encoding_in' and 'encoding_out' constructor arguments. .SS "\fIexport()\fP" .IX Subsection "export()" .Vb 1 \& my $string = $address_book\->export() .Ve .PP This method returns the vcard data as a string in the vcf file format. .PP Please note there is no validation, you must ensure that the correct nodes (\s-1FN,N,VERSION\s0) are already added to each vcard if you want to comply with \&\s-1RFC 2426.\s0 .SH "AUTHOR" .IX Header "AUTHOR" Leo Lapworth, LLAP@cuckoo.org Eric Johnson (kablamo), github ~!at!~ iijo dot org .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2003 Leo Lapworth. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" The authors of Text::vFile::asData for making my life so much easier. .SH "SEE ALSO" .IX Header "SEE ALSO" Text::vCard, Text::vCard::Node