RDF::vCard::Line(3pm)
π RDF::vCard::Line π
okay so bestie, welcome to RDF::vCard::Line β the Perl module that's literally just one line. well, one line of a vCard. it's giving tiny but mighty, fr fr. β¨
πΈ NAME πΈ
RDF::vCard::Line β represents a line within a vCard π
π¦ DESCRIPTION π¦
so like, every object you make from this class corresponds to one single line inside a vCard. and lowkey? it could also be used as the basis for other RFC 2425-based formats, like iCalendar. versatile queen behavior honestly π
β¨ Constructor β¨
new(%options)β returns a brand newRDF::vCard::Lineobject, fresh out the box, no cap.
the only options you actually need to worry about are these three:
propertyβ the property name, and it's case-insensitive so don't stress about capitalizationvalueβ an arrayref, or just a single string if you're feeling simpletype_parametersβ a hashref of property-related parameters
now here's the cute part: RDF::vCard::Entity overloads stringification, so you can literally do this:
my $line = RDF::vCard::Line->new(
property => 'email',
value => 'joe@example.net',
type_parameters => { type=>['PREF','INTERNET'] },
);
print "$line\n" if $line =~ /internet/i;
like?? it just stringifies and you can regex it. iconic. π«Ά
π Methods π
to_string()β formats the line according to RFC 2425 and RFC 2426. that's it, that's the job. slay.add_to_model($model, $node)β hand it anRDF::Trine::Modelplus anRDF::Trine::Nodethat represents the entity (i.e. the vcard) this line belongs to, and it'll add triples to the model for this line. teamwork makes the dream work πproperty()β returns the line's property, like"EMAIL". simple, elegant, no notes.property_node()β returns the line's property as anRDF::Trine::Nodethat you can use as an RDF predicate. heads up though: it returnsundefif a sensible URI cannot be found. so like, check for that bestie πproperty_order()β returns a string you can use to sort a list of lines into a sensible order. organizational queen πvalue()β returns an arrayref for the value. each item in that arrayref could be a plain scalar, OR an arrayref of scalars. messy? a little. iconic? absolutely.
for example, the arrayref representing this name:
N:Smith;John;Edward,James
which is the vCard representation of somebody with surname Smith, given name John, and additional names (middle names) Edward and James β might be represented with this value arrayref:
[
'Smith',
'John',
['Edward', 'James'],
]
or maybe:
[
['Smith'],
'John',
['Edward', 'James'],
]
see how the vibes differ?? that's exactly why it's sometimes useful to have a normalised version of it... π
nvalue()β returns a normalised version of the arrayref for the value. it will always be an arrayref of arrayrefs. for example:
[
['Smith'],
['John'],
['Edward', 'James'],
]
consistent. predictable. main character energy. β¨
value_node()β returns the line's value as anRDF::Trine::Nodethat can be used as an RDF object. but ngl, for some complex properties (e.g.ADR,GEO,ORG,N, etc) the result is not especially useful. so like, manage your expectations babe πvalue_to_string()β formats the line value according to RFC 2425 and RFC 2426. twin ofto_string()but for the value side. πtype_parameters()β returns thetype_parametershashref. here be monsters (kinda). π
π SEE ALSO π
RDF::vCard
π 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.
and that's the whole page bestie, no cap β perl v5.34.0, dated 2022-06-17, which is literally ancient history in internet years but the code still eats π β¨π¦
π¦ 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