File Coverage

blib/lib/RDF/vCard.pm
Criterion Covered Total %
statement 13 15 86.6
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 20 90.0


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