.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.40) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Text::vCard::Node 3pm" .TH Text::vCard::Node 3pm "2021-01-03" "perl v5.32.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Text::vCard::Node \- Object for each node (line) of a vCard .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use Text::vCard::Node; \& \& my %data = ( \& \*(Aqparam\*(Aq => { \& \*(AqHOME,PREF\*(Aq => \*(Aqundef\*(Aq, \& }, \& \*(Aqvalue\*(Aq => \*(Aq;;First work address \- street;Work city;London;Work PostCode;CountryName\*(Aq, \& ); \& \& my $node = Text::vCard::Node\->new({ \& node_type => \*(Aqaddress\*(Aq, # Auto upper cased \& fields => [\*(Aqpo_box\*(Aq,\*(Aqextended\*(Aq,\*(Aqstreet\*(Aq,\*(Aqcity\*(Aq,\*(Aqregion\*(Aq,\*(Aqpost_code\*(Aq,\*(Aqcountry\*(Aq], \& data => \e%data, \& }); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Package used by Text::vCard so that each element: \s-1ADR, N, TEL\s0 etc are objects. .PP You should not need to use this module directly, Text::vCard does it all for you. .SH "METHODS" .IX Header "METHODS" .SS "\fBnew()\fP" .IX Subsection "new()" .Vb 5 \& my $node = Text::vCard::Node\->new({ \& node_type => \*(Aqaddress\*(Aq, # Auto upper cased \& fields => \e[\*(Aqpo_box\*(Aq,\*(Aqextended\*(Aq,\*(Aqstreet\*(Aq,\*(Aqcity\*(Aq,\*(Aqregion\*(Aq,\*(Aqpost_code\*(Aq,\*(Aqcountry\*(Aq], \& data => \e%data, \& }); .Ve .SS "\fBvalue()\fP" .IX Subsection "value()" .Vb 2 \& # Get the value for a standard single value node \& my $value = $node\->value(); \& \& # Or set the value \& $node\->value(\*(AqNew value\*(Aq); .Ve .SS "\fBother()\fP's" .IX Subsection "other()'s" .Vb 2 \& # The fields supplied in the conf area also methods. \& my $po_box = $node\->po_box(); # if the node was an ADR. \& \& # Set the value. \& my $street = $node\->street(\*(Aq73 Sesame Street\*(Aq); .Ve .SS "node_type" .IX Subsection "node_type" Returns the type of the node itself, e.g. \s-1ADR.\s0 .SS "\fBunit()\fP" .IX Subsection "unit()" .Vb 2 \& my @units = @{ $org_node\->unit() }; \& $org_node\->unit( [ \*(AqDivision\*(Aq, \*(AqDepartment\*(Aq, \*(AqSub\-department\*(Aq ] ); .Ve .PP As \s-1ORG\s0 allows unlimited numbers of 'units' as well as and organisation \&'name', this method is a specific case for accessing those values, they are always returned as an array reference, and should always be set as an array reference. .SS "\fBtypes()\fP" .IX Subsection "types()" .Vb 1 \& my @types = $node\->types(); \& \& # or \& my $types = $node\->types(); .Ve .PP This method will return an array or an array ref depending on the calling context of types associated with the \f(CW$node\fR, undef is returned if there are no types. .PP All types returned are lower case. .SS "\fBis_type()\fP" .IX Subsection "is_type()" .Vb 1 \& if ( $node\->is_type($type) ) { \& \& # ... \& } .Ve .PP Given a type (see \fBtypes()\fR for a list of those set) this method returns 1 if the \f(CW$node\fR is of that type or undef if it is not. .SS "\fBis_pref()\fP;" .IX Subsection "is_pref();" .Vb 3 \& if ( $node\->is_pref() ) { \& print "Preferred node"; \& } .Ve .PP This method is the same as is_type (which can take a value of 'pref') but it specific to if it is the preferred node. This method is used to sort when returning lists of nodes. .SS "\fBadd_types()\fP" .IX Subsection "add_types()" .Vb 1 \& $address\->add_types(\*(Aqhome\*(Aq); \& \& my @types = qw(home work); \& $address\->add_types( \e@types ); .Ve .PP Add a type to an address, it can take a scalar or an array ref. .SS "\fBremove_types()\fP" .IX Subsection "remove_types()" .Vb 1 \& $address\->remove_types(\*(Aqhome\*(Aq); \& \& my @types = qw(home work); \& $address\->remove_types( \e@types ); .Ve .PP This method removes a type from an address, it can take a scalar or an array ref. .PP undef is returned when in scalar context and the type does not match, or when in array ref context and none of the types match, true is returned otherwise. .SS "\fBgroup()\fP" .IX Subsection "group()" .Vb 1 \& my $group = $node\->group(); .Ve .PP If called without any arguments, this method returns the group name if a node belongs to a group. Otherwise undef is returned. .PP If an argument is supplied then this is set as the group name. .PP All group names are always lowercased. .PP For example, Apple Address book used 'itemN' to group it's custom X\-AB... nodes with a \s-1TEL\s0 or \s-1ADR\s0 node. .SS "\fBexport_data()\fP" .IX Subsection "export_data()" \&\s-1NOTE:\s0 This method is deprecated and should not be used. It will be removed in a later version. .PP .Vb 1 \& my $value = $node\->export_data(); .Ve .PP This method returns the value string of a node. It is only needs to be called when exporting the information back out to ensure that it has not been altered. .SS "as_string" .IX Subsection "as_string" Returns the node as a formatted string. .SS "\s-1NOTES\s0" .IX Subsection "NOTES" If a node has a param of 'quoted\-printable' then the value is escaped (basically converting Hex return into \er\en as far as I can see). .SH "AUTHOR" .IX Header "AUTHOR" Leo Lapworth, LLAP@cuckoo.org Eric Johnson (kablamo), github ~!at!~ iijo dot org .SH "SEE ALSO" .IX Header "SEE ALSO" Text::vCard Text::vCard::Addressbook, vCard vCard, vCard::AddressBook vCard::AddressBook,