File Coverage

blib/lib/RDF/vCard.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


line stmt bran cond sub pod time code
1             package RDF::vCard;
2              
3 1     1   24372 use 5.008;
  1         4  
  1         36  
4 1     1   4 use strict;
  1         2  
  1         38  
5              
6 1     1   628 use RDF::vCard::Entity;
  0            
  0            
7             use RDF::vCard::Exporter;
8             use RDF::vCard::Importer;
9              
10             our $VERSION = '0.010';
11              
12             our $WITH_XML;
13             BEGIN {
14             local $@ = undef;
15             eval 'use RDF::vCard::Entity::WithXmlSupport;';
16             $WITH_XML = !$@;
17             }
18              
19             sub new_entity
20             {
21             my ($class, @params) = @_;
22             $class .= ($WITH_XML ? '::Entity::WithXmlSupport' : '::Entity');
23             return $class->new(@params);
24             }
25              
26             1;
27              
28             __END__
29              
30             =head1 NAME
31              
32             RDF::vCard - convert between RDF and vCard
33              
34             =head1 SYNOPSIS
35              
36             use RDF::vCard;
37             use RDF::TrineShortcuts qw(rdf_string);
38            
39             my $input = "http://example.com/contact-data.rdf";
40             my $exporter = RDF::vCard::Exporter->new;
41            
42             my $data = join '', $exporter->export_cards($input);
43             print $data; # vCard 3.0 data
44            
45             my $importer = RDF::vCard::Importer->new;
46             $importer->import_string($data);
47             print rdf_string($importer->model => 'RDFXML');
48              
49             =head1 DESCRIPTION
50              
51             This module doesn't do anything itself; it just loads RDF::vCard::Exporter
52             and RDF::vCard::Importer for you.
53              
54             =head2 RDF::vCard::Exporter
55              
56             L<RDF::vCard::Exporter> takes some RDF using the W3C's vCard vocabulary,
57             and outputs L<RDF::vCard::Entity> objects.
58              
59             =head2 RDF::vCard::Importer
60              
61             L<RDF::vCard::Importer> does the reverse.
62              
63             =head2 RDF::vCard::Entity
64              
65             An L<RDF::vCard::Entity> objects is an individual vCard. It overloads
66             stringification, so just treat it like a string.
67              
68             =head2 RDF::vCard::Entity::WithXmlSupport
69              
70             L<RDF::vCard::Entity::WithXmlSupport> is a subclass of L<RDF::vCard::Entity>,
71             with a C<to_xml> method. It requires L<XML::LibXML> to be installed and
72             working. The importer and exporter will try to create these if possible.
73              
74             =head2 RDF::vCard::Line
75              
76             L<RDF::vCard::Line> is internal fu that you probably don't want to touch.
77              
78             =head1 BUGS
79              
80             If your RDF asserts that Alice is Bob's AGENT and Bob is Alice's AGENT, then
81             L<RDF::vCard::Export> will eat your face. Don't do it.
82              
83             Please report any other bugs to
84             L<https://rt.cpan.org/Public/Dist/Display.html?Name=RDF-vCard>.
85              
86             =head1 SEE ALSO
87              
88             L<http://www.w3.org/Submission/vcard-rdf/>.
89              
90             L<http://perlrdf.org/>.
91              
92             L<RDF::vCard::Babelfish>.
93              
94             =head1 AUTHOR
95              
96             Toby Inkster E<lt>tobyink@cpan.orgE<gt>.
97              
98             =head1 COPYRIGHT
99              
100             Copyright 2011 Toby Inkster
101              
102             This library is free software; you can redistribute it and/or modify it
103             under the same terms as Perl itself.
104