RDF::v...porter(3pm)
π NAME π
RDF::vCard::Exporter β bestie, this one exports your RDF data into vCard format β¨ (and yes it's from the User Contributed Perl Documentation collection, iykyk)
πΈ SYNOPSIS πΈ
use RDF::vCard;
my $input = "http://example.com/contact-data.rdf";
my $exporter = RDF::vCard::Exporter->new(vcard_version => 3);
print $_ foreach $exporter->export_cards($input);
β¨ DESCRIPTION β¨
okay so literally the whole vibe of this module: it reads RDF and it writes vCards. that's it. that's the job. π«Ά
π Constructor
new(%options)β hands you back a fresh, shiny new RDF::vCard::Exporter object π
Here's what you can pass in:
vcard_versionβ either'3'or'4'. Lowkey important tea: this module will happily use vCard 3.0 constructs inside vCard 4.0 and vice versa, it does not care. But in certain places it can lean one way or the other, and this option is how you nudge it. π
π¦ Methods
export_cards($input, %options)β returns a list of all the vCards it found in the input, in no particular order (so don't come for it about ordering, bestie).
The input can be a URI, a file name, an RDF::Trine::Model, or literally anything else that the rdf_parse method of RDF::TrineShortcuts can handle. flexible queen π
Supported options include sort, which β if you set it to true β makes the output sorted by name (as well as is possible, no promises okay); source, which lets you provide the URL where the cards were sourced from; and prodid, which lets you set the product ID used in the output.
Heads up: aprodidhas to be in FPI format to actually be valid, though the module doesn't check this.undefis allowed. By default,RDF::vCard:Exporteruses its own prodid, and unless you have a genuinely good reason to change it, you should probably just let it. π
e.g.
my @cards = $exporter->export_cards(
$some_data,
sort => 1,
source => 'http://bigcorp.example.com/data.rdf',
prodid => '+//IDN example.net//NONSGML MyScript v 0.1//EN',
);
Every single item in that returned list is an RDF::vCard::Entity β but that class overloads stringification, so you can mostly just treat each item as a string and move on with your day. π
export_card($input, $subject, %options)β same energy asexport_cardsbut it exports just one single card. main character energy, no ensemble cast.
The $subject you provide must be an RDF::Trine::Node::Blank or RDF::Trine::Node::Resource of type v:VCard.
is_v3β returns true if this exporter is in vCard 3.0 mode. βis_v4β returns true if this exporter is in vCard 4.0 mode. β
π§ RDF Input
Input is expected to use the newer of the 2010 revision of the W3C's vCard vocabulary <http://www.w3.org/Submission/vcard-rdf/>. (and yes, the way that even though this was revised in 2010, the term URIs still include "2006" in themβ¦ iconic mess, we love her π)
Some extensions from the namespace <http://buzzword.org.uk/rdf/vcardx#> are also supported. Namely: vx:usage, vx:kind, vx:gender, vx:sex, vx:dday, vx:anniversary, vx:lang, vx:caladruri, vx:caluri, vx:fburl, vx:impp, vx:source. π
The module author made the decision not to support FOAF and other RDF vocabularies that may be used to model contact information for people and organisations, because they don't necessarily map cleanly onto vCard. So if you were hoping to map non-vCard RDF to vCard with this module, you might have some luck pre-processing your RDF using a rules-based reasoner. fr fr, that's the path. π«‘
π vCard Output
The output of this module mostly aims at vCard 3.0 (RFC 2426) compliance. But in the face of weird input data though β e.g. an FN property that is a URI instead of a literal β it can pretty easily descend into exporting junk, non-compliant vCards. it's giving chaos, not perfection π
Many vCard 4.0 properties, such as the IMPP and KIND, are also supported. β¨
The vcard_version constructor option allows you to influence how some properties like GEO and TEL (which differ between 3.0 and 4.0) are output. π
π SEE ALSO π
RDF::vCard,HTML::Microformats,RDF::TrineShortcuts.- <http://www.w3.org/Submission/vcard-rdf/>.
- <http://www.perlrdf.org/>.
π AUTHOR π
Toby Inkster <tobyink@cpan.org>. π
π COPYRIGHT π
Copyright 2011 Toby Inkster
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
okay that's the whole page bestie, you ate that π«Ά this was the perl v5.34.0 build from 2022-06-17, and the file header calls itself RDF::v...porter(3pm) β go forth and export some cards, mwah π β¨
π¦ where this page comes from
- debian bookworm: librdf-vcard-perl 0.012-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: librdf-vcard-perl 0.012-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms