.\" 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 "vCard::AddressBook 3pm" .TH 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" vCard::AddressBook \- Read, write, and edit vCard address books .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use vCard::AddressBook; \& \& # create the object \& my $address_book = vCard::AddressBook\->new(); \& \& # these methods load vCard formatted data \& $address_book\->load_file(\*(Aq/path/file.vcf\*(Aq); \& $address_book\->load_string($string); \& \& my $vcard = $address_book\->add_vcard; # returns a vCard object \& $vcard\->full_name(\*(AqBruce Banner, PhD\*(Aq); \& $vcard\->family_names([\*(AqBanner\*(Aq]); \& $vcard\->given_names([\*(AqBruce\*(Aq]); \& $vcard\->email_addresses([ \& { type => [\*(Aqwork\*(Aq], address => \*(Aqbbanner@ssh.secret.army.mil\*(Aq }, \& { type => [\*(Aqhome\*(Aq], address => \*(Aqbbanner@timewarner.com\*(Aq }, \& ]); \& \& # $address_book\->vcards() returns an arrayref of vCard objects \& foreach my $vcard (@{ $address_book\->vcards() }) { \& print $vcard\->full_name() . "\en"; \& print $vcard\->email_addresses\->[0]\->{address} . "\en"; \& } \& \& # these methods output data in vCard format \& my $file = $address_book\->as_file(\*(Aq/path/file.vcf\*(Aq); # write to a file \& my $string = $address_book\->as_string(); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" A vCard is a digital business card. vCard and vCard::AddressBook provide an \&\s-1API\s0 for parsing, editing, and creating vCards. .PP This module is built on top of Text::vCard and Text::vCard::AddressBook and provides a more intuitive user interface. .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 parameters 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 parameters 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 parameter. .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 "Getting and setting values on a vCard object" .IX Subsection "Getting and setting values on a vCard object" If you set values on a vCard object they must be decoded values. The only exception to this rule is if you are messing around with the \&'encoding_out' constructor arg. .PP When you get values from a vCard object they will be decoded values. .SH "METHODS" .IX Header "METHODS" .SS "\fIadd_vcard()\fP" .IX Subsection "add_vcard()" Creates a new vCard object and adds it to the address book. Returns a vCard object. .SS "load_file($filename)" .IX Subsection "load_file($filename)" Load and parse the contents of \f(CW$filename\fR. Returns \f(CW$self\fR so the method can be chained. .SS "load_string($string)" .IX Subsection "load_string($string)" Load and parse the contents of \f(CW$string\fR. This method assumes that \f(CW$string\fR is decoded (but not \s-1MIME\s0 decoded). Returns \f(CW$self\fR so the method can be chained. .SS "as_file($filename)" .IX Subsection "as_file($filename)" Write all the vCards to \f(CW$filename\fR. Files are written as \s-1UTF\-8\s0 by default. Dies if not successful. .SS "\fIas_string()\fP" .IX Subsection "as_string()" Returns all the vCards as a single string. .SH "AUTHOR" .IX Header "AUTHOR" Eric Johnson (kablamo), github ~!at!~ iijo dot org .SH "ACKNOWLEDGEMENTS" .IX Header "ACKNOWLEDGEMENTS" Thanks to Foxtons for making this module possible by donating a significant amount of developer time.