RDF::v...Entity(3pm)

πŸ“¦
version 0.012 Β· 4 versions
, in debian bookworm, ubuntu noble

✨ RDF::vCard::Entity β€” the whole vibe πŸ’³

okay so bestie, this is RDF::vCard::Entity β€” it's the class that represents one single vCard. like, one whole contact card, one little entity, just vibing on its own. and ngl it's lowkey built to be a little more flexible than that, because it could potentially be used as the basis for other RFC 2425-based formats too, like iCalendar. it's giving "main character but also willing to share the spotlight." πŸŽ€


🌸 DESCRIPTION 🌸

Every instance of this class corresponds to an individual vCard object. fr fr, that's the whole point of it. but also β€” she's flexible β€” she could potentially be used as a basis for other RFC 2425-based formats such as iCalendar. versatile queen. πŸ‘‘

πŸ’… Constructor

  • new(%options) β€” returns a brand new RDF::vCard::Entity object. fresh out the box, no cap.

The only option worth worrying about is profile, which sets the profile for the entity. it defaults to VCARD. that's the default. don't overthink it. ✨

Also, RDF::vCard::Entity overloads stringification, so you can literally do this:

my $vcard = RDF::vCard::Entity->new;
print $vcard if $vcard =~ /VCARD/i;

look at her go πŸ¦‹

🧚 Methods

  • to_string() β€” formats the object according to RFC 2425 and RFC 2426. the classic, the original, the blueprint. πŸ’–
  • to_jcard() β€” formats the object according to http://microformats.org/wiki/jcard. and heads up: to_jcard(1) will return the same data but without the JSON stringification. same snack, different presentation. πŸ“
  • add_to_model($model) β€” you hand it an RDF::Trine::Model and it adds triples to the model for this entity. she's contributing to the graph. iconic. 🌈
  • node() β€” returns an RDF::Trine::Node::Blank that identifies this entity. it's her lil name tag. πŸŽ€
  • entity_order() β€” returns a string along the lines of "Surname;Forename", which is useful for sorting a list of entities. alphabetize your besties, periodt. πŸ’…
  • profile() β€” returns the entity type β€” e.g. "VCARD". that's it, that's the tea. β˜•
  • lines() β€” returns an arrayref of RDF::vCard::Line objects, in the order they were originally added. she remembers everything, in order. and just so you know: this excludes the BEGIN:VCARD and END:VCARD lines. those two are not invited to this list. πŸ™ˆ
  • add($line) β€” add a RDF::vCard::Line. one line at a time, bestie. 🫢
  • get($property) β€” returns a list of RDF::vCard::Line objects for the given property. e.g.
print "It has an address!\n" if ($vcard->get('ADR'));
  • matches($property, $regexp) β€” checks to see if a property's value matches a regular expression. like a vibe check but for data. πŸ‘€
print "In London\n" if $vcard->matches(ADR => /London/);
  • add_component($thing) β€” adds a nested entity within this one. this method is unused for vCard, but it's a hook for the benefit of RDF::iCalendar. so she's holding space for her friend. πŸ’œ
  • components β€” lists nested entities within this one. peek inside, see who's living in there. πŸ”₯

πŸ‘‘ SEE ALSO πŸ‘‘

RDF::vCard.


πŸ’– AUTHOR πŸ’–

Toby Inkster <tobyink@cpan.org>.


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! πŸŽ€ this was RDF::vCard::Entity(3pm) from the User Contributed Perl Documentation, running on perl v5.34.0, dated 2022-06-17. go forth and build your vCards, you absolute legend. slay. βœ¨πŸ’…πŸ¦‹

πŸ“¦ where this page comes from