Author image Michael Tomuschat
and 1 contributors

NAME

Text::SimpleVcard - a package to manage a single vCard

VERSION

Version 0.05

SYNOPSIS

simplevCard - This package provides an API to reading a single vCard. A vCard is an electronic business card. You will find that many applications (KDE Address book, Apple Address book, MS Outlook, Evolution, etc.) use and can export and import vCards.

This module offers only basic vcard features (folding, ...). Grouping, etc. is not yet supported. Further enhancements are always welcome.

SimpleVcard has a minimum of dependencies (actually only 'MIME::QuotedPrint'), it should work with every installation.

   use Text::SimpleVcard;

   open FH, "< std.vcf";        # 'std.vcf' contains a single vcard-entry
   my $vCard = Text::SimpleVcard->new( join( '', <FH>));
   $vCard->print();
   print "FN=" . $vCard->getSimpleValue( 'FN') . "\n";
   print "fullname=" . $vCard->getFullName() . "\n";
   my %h = $vCard->getValuesAsHash( 'TEL', [qw( WORK HOME)]);

   print "phone-numbers are:\n";
   foreach( keys %h) {
      print "Got number $_ ($h{$_})\n";
   }

FUNCTIONS

new()

   my $vCard = simpleVcard->new( $dat);

The method will create a simpleVcard object from vcard data (e.g. from a vCard-File (see example above)). Nested vCards will be ignored.

print()

   $vCard->print();
   $vCard->sprint();

The method will print a simpleVcard-object to stdout or, in case of sprint() to a string

getSimpleValue()

   $vCard->getSimpleValue( $prop);
   $vCard->getSimpleValue( $prop, $n);

The method will fetch the first (or, if an index is provided, the n'th) value of the specified property. If the property or the index doesn't exist, it returns undef

getSimpleValueOfType()

   $vCard->getSimpleValueOfType( $prop, [qw( WORK HOME)]]);
   $vCard->getSimpleValueOfType( $prop, [qw( WORK HOME)]], $n);

The method will fetch the first (or, if an index is provided, the n'th) value of the specified property of the desired type. If the property or the index doesn't exist, it returns undef

getFullName()

   $vCard->getFullName();

The method will fetch the value of the property FN, and get rid off any backslashes found in that value

getValuesAsHash()

   $vCard->getValuesAsHash( 'TEL', [qw( WORK HOME)]]);

The method will return a hash returning the values of the provided property. The value will contain a CSV-list of the matching types. if no types are provided, it will return all types found.

AUTHOR

Michael Tomuschat, <michael.tomuschat at t-online.de>

SEE ALSO

Text::SimpleAdrbook - A module that can read several vCard-files

BUGS

Please report any bugs or feature requests to bug-text-simplevcard at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Text-SimpleVcard. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Text::SimpleVcard

You can also look for information at:

COPYRIGHT & LICENSE

Copyright 2008-2009 Michael Tomuschat, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.