Represents a line within a vcard
Instances of this class correspond to lines within vCards, though they could potentially be used as basis for other \s-1RFC\s0 2425-based formats such as iCalendar.
\*(C`new(%options)\*(C' Returns a new RDF::vCard::Line object. The only options worth worrying about are: property (case-insensitive property name), value (arrayref or single string value), type_parameters (hashref of property-related parameters). RDF::vCard::Entity overloads stringification, so you can do the following:
my $line = RDF::vCard::Line->new( property => 'email', value => '[email protected]', type_parameters => { type=>['PREF','INTERNET'] }, ); print "$line\n" if $line =~ /internet/i;
\*(C`to_string()\*(C' Formats the line according to \s-1RFC\s0 2425 and \s-1RFC\s0 2426.
\*(C`add_to_model($model, $node)\*(C' Given an RDF::Trine::Model and an RDF::Trine::Node representing the entity (i.e. vcard) that this line belongs to, adds triples to the model for this line.
\*(C`property()\*(C' Returns the line's property - e.g. \*(L"\s-1EMAIL\s0\*(R".
\*(C`property_node()\*(C' Returns the line's property as an RDF::Trine::Node that can be used as an \s-1RDF\s0 predicate. Returns undef if a sensible \s-1URI\s0 cannot be found.
\*(C`property_order()\*(C' Returns a string which can be used to sort a list of lines into a sensible order.
\*(C`value()\*(C' Returns an arrayref for the value. Each item in the arrayref could be a plain scalar, or an arrayref of scalars. 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 the following \*(L"value\*(R" arrayref: [ 'Smith', 'John', ['Edward', 'James'], ] or maybe: [ ['Smith'], 'John', ['Edward', 'James'], ] That's why it's sometimes useful to have a normalised version of it...
\*(C`nvalue()\*(C' Returns a normalised version of the arrayref for the value. It will always be an arrayref of arrayrefs. For example: [ ['Smith'], ['John'], ['Edward', 'James'], ]
\*(C`value_node()\*(C' Returns the line's value as an RDF::Trine::Node that can be used as an \s-1RDF\s0 object. For some complex properties (e.g. \s-1ADR\s0, \s-1GEO\s0, \s-1ORG\s0, N, etc) the result is not especially useful.
\*(C`value_to_string()\*(C' Formats the line value according to \s-1RFC\s0 2425 and \s-1RFC\s0 2426.
\*(C`type_parameters()\*(C' Returns the type_parameters hashref. Here be monsters (kinda).
RDF::vCard.
Toby Inkster <[email protected]>.
Copyright 2011 Toby Inkster
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.