vCard(3pm)
π vCard β like, the Perl module, bestie
okay so this is vCard(3pm), from the User Contributed Perl Documentation section of the manual, and it's genuinely one of the cutest little modules out there. it's a Perl thing. it reads, writes, and edits vCards. let's go π
β¨ NAME β¨
vCard β read, write, and edit vCards. that's it. that's the whole vibe. π
πΈ SYNOPSIS πΈ
here's the whole flow, no gatekeeping:
use vCard;
# create the object
my $vcard = vCard->new;
# these methods load vCard data
# (see method documentation for details)
$vcard->load_file($filename);
$vcard->load_string($string);
$vcard->load_hashref($hashref);
# simple getters/setters
$vcard->full_name('Bruce Banner, PhD');
$vcard->title('Research Scientist');
$vcard->photo('http://example.com/bbanner.gif');
# complex getters/setters
$vcard->phones([
{ type => ['work', 'text'], number => '651-290-1234', preferred => 1 },
{ type => ['home'], number => '651-290-1111' }
]);
$vcard->email_addresses([
{ type => ['work'], address => 'bbanner@ssh.secret.army.mil' },
{ type => ['home'], address => 'bbanner@timewarner.com' },
]);
# these methods output data in vCard format
my $file = $vcard->as_file($filename); # writes to $filename
my $string = $vcard->as_string; # returns a string
like... it's giving "I have a business card and it's digital". obsessed. π₯
π¦ DESCRIPTION π¦
A vCard is a digital business card. periodt. π³β¨
vCard and vCard::AddressBook team up to give you an API for parsing, editing, and creating vCards. bestie duo fr fr.
This module is built on top of Text::vCard. It just... provides a more intuitive user interface. the way that it's the glow-up version π
If you're dealing with an address book that has several vCard entries in it, start with vCard::AddressBook and then come back to this module. iykyk.
β οΈ heads up babes: the vCard RFC requiresversion()andfull_name(). This module does not check or warn if these conditions have not been met. so like, do your part. π
π ENCODING AND UTF-8 π
See the 'ENCODING AND UTF-8' section of vCard::AddressBook. it's all over there, go look π
π METHODS π
π load_hashref($hashref)
$hashref should look like this:
full_name => 'Bruce Banner, PhD',
given_names => ['Bruce'],
family_names => ['Banner'],
title => 'Research Scientist',
photo => 'http://example.com/bbanner.gif',
phones => [
{ type => ['work'], number => '651-290-1234', preferred => 1 },
{ type => ['cell'], number => '651-290-1111' },
],
addresses => [
{ type => ['work'], ... },
{ type => ['home'], ... },
],
email_addresses => [
{ type => ['work'], address => 'bbanner@shh.secret.army.mil' },
{ type => ['home'], address => 'bbanner@timewarner.com' },
],
Returns $self in case you feel like chaining. π slay.
π load_file($filename)
Returns $self in case you feel like chaining. π
π load_string($string)
Returns $self in case you feel like chaining. π
This method assumes $string is decoded (but not MIME decoded). noted. π
π as_string()
Returns the vCard as a string. π«
π as_file($filename)
Write data in vCard format to $filename. πΎ
π Dies if not successful. like, it will simply pass away.
π SIMPLE GETTERS/SETTERS π
These methods accept and return strings. simple. clean. iconic. β¨
version()β Version number of the vcard. Defaults to'4.0'full_name()β A person's entire name as they would like to see it displayed. (their name, their rules π)title()β A person's position or job.photo()β This should be a link. Accepts a string or a URI object. This method always returns a URI object.- TODO: handle binary images using the data uri schema
birthday()β yeah. it's the birthday. πtimezone()β the timezone, bestie. π
π COMPLEX GETTERS/SETTERS π
These methods accept and return array references rather than simple strings. fancy, i know. π«Ά
family_names()β Accepts/returns an arrayref of family names (aka surnames).given_names()β Accepts/returns an arrayref.other_names()β Accepts/returns an arrayref of names which don't qualify asfamily_namesorgiven_names.honorific_prefixes()β Accepts/returns an arrayref. eg"[ 'Dr.' ]"honorific_suffixes()β Accepts/returns an arrayref. eg"[ 'Jr.', 'MD' ]"phones()β Accepts/returns an arrayref that looks like:
[
{ type => ['work'], number => '651-290-1234', preferred => 1 },
{ type => ['cell'], number => '651-290-1111' },
]
addresses()β Accepts/returns an arrayref that looks like:
[
{ type => ['work'], street => 'Main St', preferred => 0 },
{ type => ['home'],
pobox => 1234,
extended => 'asdf',
street => 'Army St',
city => 'Desert Base',
region => '',
post_code => '',
country => 'USA',
preferred => 1,
},
]
email_addresses()β Accepts/returns an arrayref that looks like:
[
{ type => ['work'], address => 'bbanner@ssh.secret.army.mil' },
{ type => ['home'], address => 'bbanner@timewarner.com', preferred => 1 },
]
β AUTHOR β
Eric Johnson (kablamo), github ~!at!~ iijo dot org
π«Ά ACKNOWLEDGEMENTS π«Ά
Thanks to Foxtons <http://foxtons.co.uk> for making this module possible by donating a significant amount of developer time. absolute legends, no cap. π
okay and for the lil' sign-off moment: this whole thing is documented for perl v5.34.0 and dated 2022-06-28 β so yeah, that's the vCard(3pm) era we're living in. go forth and make digital business cards, bestie. mwah ππβ¨
π¦ where this page comes from
- debian bookworm: libtext-vcard-perl 3.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtext-vcard-perl 3.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtext-vcard-perl 3.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtext-vcard-perl 3.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtext-vcard-perl 3.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms