Text::vFile::toXML - Convert vFiles into equivalent XML
Version 0.04
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.
No functions are exported by default; you can choose to import the 'to_xml' function if you wish to use the functional interface.
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)
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.
Recursively converts Text::vFile::asData structures to XML::Quick-compatible ones.
Darren Kulp, <kulp at cpan.org>
<kulp at cpan.org>
Probably. Email me at the address above with bug reports.
The Text::vFile::asData and XML::Quick modules proved very useful, to the point of nearly trivializing this module.
Copyright 2006 Darren Kulp.
This program is released under the terms of the BSD license.
To install Text::vFile::toXML, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::vFile::toXML
CPAN shell
perl -MCPAN -e shell install Text::vFile::toXML
For more information on module installation, please visit the detailed CPAN module installation guide.