GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
vCard(3) User Contributed Perl Documentation vCard(3)
 

vCard - Read, write, and edit vCards

    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

A vCard is a digital business card. vCard and vCard::AddressBook provide an API for parsing, editing, and creating vCards.
This module is built on top of Text::vCard. It provides a more intuitive user interface.
To handle an address book with several vCard entries in it, start with vCard::AddressBook and then come back to this module.
Note that the vCard RFC requires version() and full_name(). This module does not check or warn if these conditions have not been met.

See the 'ENCODING AND UTF-8' section of vCard::AddressBook.

$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.

Returns $self in case you feel like chaining.

Returns $self in case you feel like chaining. This method assumes $string is decoded (but not MIME decoded).

Returns the vCard as a string.

Write data in vCard format to $filename.
Dies if not successful.

These methods accept and return strings.

Version number of the vcard. Defaults to '4.0'

A person's entire name as they would like to see it displayed.

A person's position or job.

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

These methods accept and return array references rather than simple strings.

Accepts/returns an arrayref of family names (aka surnames).

Accepts/returns an arrayref.

Accepts/returns an arrayref of names which don't qualify as family_names or given_names.

Accepts/returns an arrayref. eg "[ 'Dr.' ]"

Accepts/returns an arrayref. eg "[ 'Jr.', 'MD' ]"

Accepts/returns an arrayref that looks like:
  [
    { type => ['work'], number => '651-290-1234', preferred => 1 },
    { type => ['cell'], number => '651-290-1111' },
  ]

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,
    },
  ]

Accepts/returns an arrayref that looks like:
  [
    { type => ['work'], address => 'bbanner@ssh.secret.army.mil' },
    { type => ['home'], address => 'bbanner@timewarner.com', preferred => 1 },
  ]

Eric Johnson (kablamo), github ~!at!~ iijo dot org

Thanks to Foxtons <http://foxtons.co.uk> for making this module possible by donating a significant amount of developer time.
2016-10-23 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.