Why not adopt me?
NAME
Text::vFile::toXML - Convert vFiles into equivalent XML
VERSION
Version 0.02
SYNOPSIS
This module converts iCalendar (iCal : generically, vFile) files into their (equivalent) XML (xCalendar / xCal) representation, according to Royer's IETF Draft (http://tools.ietf.org/html/draft-royer-calsch-xcal-03).
# Enable functional interface
use Text::vFile::toXML qw(to_xml);
# Input filename
my $arg = "input.file";
my $a = Text::vFile::toXML->new(filename => $arg)->to_xml;
my $b = Text::vFile::toXML->new(filehandle =>
do { open my $fh, $arg or die "can't open ics: $!"; $fh }
)->to_xml;
use Text::vFile::asData; # to make the functional example work
my $data =
Text::vFile::asData->new->parse(
do {
open my $fh, $arg
or die "Can't open vFile: $!"; $fh
}
);
my $c = Text::vFile::toXML->new(data => $data)->to_xml;
# Use functional interface
my $d = to_xml($data);
# Now ($a, $b, $c, $d) all contain the same XML string.
EXPORT
No functions are exported by default; you can choose to import the 'to_xml' function if you wish to use the functional interface.
METHODS
new
Creates a new Text::vFile::toXML object; takes a list of key-value pairs for initialization, which must contain exactly one of the following:
filehandle => (filehandle object)
filename => (string)
data => (Text::vFile::asData struct)
to_xml
Wraps the convert() function; returns an XML string. Can be called as an instance method (OO-style) or as a function (functional style), in which case it takes a Text::vFile::asData-compatible data structure as its only parameter.
convert
Recursively converts Text::vFile::asData structures to XML::Quick-compatible ones.
AUTHOR
Darren Kulp, <kulp at cpan.org>
BUGS
Probably. Email me at the address above with bug reports.
ACKNOWLEDGEMENTS
The Text::vFile::asData and XML::Quick modules proved very useful, to the point of nearly trivializing this module.
COPYRIGHT & LICENSE
Copyright 2006 Darren Kulp, all rights reserved.
This program is released under the terms of the BSD license.