Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Net::vFile(3)	      User Contributed Perl Documentation	 Net::vFile(3)

NAME
       Net::vFile - Generic module which can read and write "vFile" files such
       as vCard	(RFC 2426) and vCalendar (RFC 2445).  The result of loading
       this data is a collection of objects which will grant you easy access
       to the properties. Then the module can write your objects back to a
       data file.

SYNOPIS
	   use Net::vCard;

	   my $cards = Net::vCard->loadFile( "foo.vCard", "blort.vCard", "whee.vCard" );

	   foreach my $card (@$cards) {
	       spam ( $card->EMAIL('default') );
	   }

DETAILS
       The way this processor works is that it reads the vFile line by line.

       1 - BEGIN:(.*) tag

	  $1 is	looked up in classMap; class is	loaded;	new object of this class is created
	  ie/ $Net::vFile::classMap{'VCARD'}="Net::vCard";
	      $object=$classMap{'VCARD'}->new;

	   n.b.	classMap is a package variable for Net::vFile

       2 - All lines are read and stored until a BEGIN tag (goto 1) or END tag
       (goto 3)	is reached

       3 - END:(.*) tag

	  Signals that all entry data has been obtained	and now	the rows of data are processed

       4 - Data	is concatenated	- thanks to Net::iCal for the strategy;	the
       tag label and data are obtained

       5 - The data handler is identified via $object->varHandler->{$label}

	   There are some generic handlers for common data types such as simple	strings, dates,	etc. More
	   elaborate data types	such as	N, ADR,	etc. need special treatment and	are declared explititly
	   in classes as "load_XXX" such as "load_N"

       You should be able to override and extend the processing	by taking
       Net::vCard.pm as	your example and adjusting as necessary.

       The resulting data structure is a bit bulky - but is such that it can
       express vCard data completely and reliably

	 Put in	a dump of a vCard here

DEPENDENCIES
	DateTime::Format::ICal

       \@objects = loadFile( filename [, filename ... ]	)
	   Loads the vFiles and	returns	an array of objects

       $object = class->new
	   Make	a new object

       \@objects = Class->load(	filehandle )
	   Loads data from file	handle and creates objects as necessary

       $object->error
	   Called when a line cannot be	successfully decoded

DATA HANDLERS
       varHandler
	   Returns a hash ref mapping the item label to	a handler name.	Ie:

	      {
		   'FN'		 => 'singleText',
		   'N'		 => 'N',
		   'NICKNAME'	 => 'multipleText',
		   'PHOTO'	 => 'singleBinary',
		   'BDAY'	 => 'singleText',
		   'ADR'	 => 'ADR',
	       };

       typeDefault
	   Additional information where	handlers require type info. Such as
	   ADR - is this a home, postal, or whatever? If not supplied the RFC
	   specifies what types	they should default to.

		from vCard:

		{
		   'ADR'     =>	[ qw(intl postal parcel	work) ],
		   'LABEL'   =>	[ qw(intl postal parcel	work) ],
		   'TEL'     =>	[ qw(voice) ],
		   'EMAIL'   =>	[ qw(internet) ],
	       };

       load_singleText
	   Loads a single text item with no processing other than unescape
	   text

       _singleText
	   Accessor for	single text items

       load_singleDate
	   Loads a date	creating a DateTime::Format::ICal object. Thanks Dave!

       load_singleDuration
	   Loads a data	duration using DateTime::Format::ICal.

       load_multipleText
	   This	is text	that is	separated by commas. The text is then
	   unescaped. An array of items	is created.

       load_singleTextType
	   Load	text that has a	type attribute.	Each text of different type
	   attributes will be handled independantly in as a hash entry.	If no
	   type	attribute is supplied then the typeDefaults types will be
	   used. A line	can have multiple types. In the	case where multiple
	   types have the same value "_alias" indicators are created.  The
	   preferred type is stored in "_pref"

       load_singleBinary
	   Not done as I don't have example data yet.

SUPPORT
       For technical support please email to jlawrenc@cpan.org ...  for	faster
       service please include "Net::vFile" and "help" in your subject line.

AUTHOR
	Jay J. Lawrence	- jlawrenc@cpan.org
	Infonium Inc., Canada
	http://www.infonium.ca/

COPYRIGHT
       Copyright (c) 2003 Jay J. Lawrence, Infonium Inc. All rights reserved.
       This program is free software; you can redistribute it and/or modify it
       under the same terms as Perl itself.

       The full	text of	the license can	be found in the	LICENSE	file included
       with this module.

ACKNOWLEDGEMENTS
	Net::iCal - whose loading code inspired	me for mine

SEE ALSO
       RFC 2426, Net::iCal

perl v5.24.1			  2003-04-15			 Net::vFile(3)

NAME | SYNOPIS | DETAILS | DEPENDENCIES | DATA HANDLERS | SUPPORT | AUTHOR | COPYRIGHT | ACKNOWLEDGEMENTS | SEE ALSO

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Net::vFile&sektion=3&manpath=FreeBSD+12.1-RELEASE+and+Ports>

home | help