NAME

Text::vCard::Part - Parent object to handle several parts of a vCard

SYNOPSIS

package YOUR_PACKAGE_NAME_HERE;
use base qw(Text::vCard::Part);

sub config {
	my %config = (
		# If the package refers to a part with multipul values
		'field_names' 		=> ['pobox','extad',...],
	);
	return \%config;
}

DESCRIPTION

This package can be inherited from when additional parts of a vCard need to become objects, such as Address and Name. The created objects are called from Text::vCard so you probably don't want to use this package directly your self unless you are helping maintain Text::vCard.

METHODS

my $object = $vcard->object();

my $value = $object->method();
$object->method($value);
$object->method(\@value);

The methods are autogenerated from the field_names in the config method.

types()

my @types = $part->types();
or
my $types = $part->types();

This method will return an array or an array ref depending on the calling context of types associated with the $part, undef is returned if there are no types.

is_type()

if($part->is_type($type) {
	# ...
}

Given a type (see types() for a list of possibilities) this method returns 1 if the $part is of that type or undef if it is not.

is_pref();

if($part->is_pref()) {
	print "Prefered part"
}

This method is the same as is_type (which can take a value of 'pref') but it specific to if it is the prefered part. This method is used to sort when returning lists of parts.

add_type()

$address->add_type('home');

my @types = qw(home work);
$address->add_type(\@types);

Add a type to an address, it can take a scalar or an array ref.

remove_type()

$address->remove_type('home');

my @types = qw(home work);
$address->remove_type(\@types);

This method removes a type from an address, it can take a scalar or an array ref.

update_value()

my $value = $part->update_value();

This method updates and returns the value string of a part. It is only needs to be called when exporting the information back out to ensure that it has not been altered.

NOTE: considered running it everytime a field was updated but that seemed like overkill.

EXPORT

None by default.

AUTHOR

Leo Lapworth, LLAP@cuckoo.org

SEE ALSO

Text::vCard.