1Text::vCard::Node(3)  User Contributed Perl Documentation Text::vCard::Node(3)
2
3
4

NAME

6       Text::vCard::Node - Object for each node (line) of a vCard
7

SYNOPSIS

9         use Text::vCard::Node;
10
11         my %data = (
12           'param' => {
13             'HOME,PREF' => 'undef',
14           },
15           'value' => ';;First work address - street;Work city;London;Work PostCode;CountryName',
16         );
17
18         my $node = Text::vCard::Node->new({
19           node_type => 'address', # Auto upper cased
20           fields => ['po_box','extended','street','city','region','post_code','country'],
21           data => \%data,
22         });
23

DESCRIPTION

25       Package used by Text::vCard so that each element: ADR, N, TEL etc are
26       objects.
27
28       You should not need to use this module directly, Text::vCard does it
29       all for you.
30

METHODS

32   new()
33         my $node = Text::vCard::Node->new({
34           node_type => 'address', # Auto upper cased
35           fields => \['po_box','extended','street','city','region','post_code','country'],
36           data => \%data,
37         });
38
39   value()
40         # Get the value for a standard single value node
41         my $value = $node->value();
42
43         # Or set the value
44         $node->value('New value');
45
46   other()'s
47         # The fields supplied in the conf area also methods.
48         my $po_box = $node->po_box(); # if the node was an ADR.
49
50         # Set the value.
51         my $street = $node->street('73 Sesame Street');
52
53   node_type
54       Returns the type of the node itself, e.g. ADR.
55
56   unit()
57         my @units = @{ $org_node->unit() };
58         $org_node->unit( [ 'Division', 'Department', 'Sub-department' ] );
59
60       As ORG allows unlimited numbers of 'units' as well as and organisation
61       'name', this method is a specific case for accessing those values, they
62       are always returned as an array reference, and should always be set as
63       an array reference.
64
65   types()
66         my @types = $node->types();
67
68         # or
69         my $types = $node->types();
70
71       This method will return an array or an array ref depending on the
72       calling context of types associated with the $node, undef is returned
73       if there are no types.
74
75       All types returned are lower case.
76
77   is_type()
78         if ( $node->is_type($type) ) {
79
80             # ...
81         }
82
83       Given a type (see types() for a list of those set) this method returns
84       1 if the $node is of that type or undef if it is not.
85
86   is_pref();
87         if ( $node->is_pref() ) {
88             print "Preferred node";
89         }
90
91       This method is the same as is_type (which can take a value of 'pref')
92       but it specific to if it is the preferred node. This method is used to
93       sort when returning lists of nodes.
94
95   add_types()
96         $address->add_types('home');
97
98         my @types = qw(home work);
99         $address->add_types( \@types );
100
101       Add a type to an address, it can take a scalar or an array ref.
102
103   remove_types()
104         $address->remove_types('home');
105
106         my @types = qw(home work);
107         $address->remove_types( \@types );
108
109       This method removes a type from an address, it can take a scalar or an
110       array ref.
111
112       undef is returned when in scalar context and the type does not match,
113       or when in array ref context and none of the types match, true is
114       returned otherwise.
115
116   group()
117         my $group = $node->group();
118
119       If called without any arguments, this method returns the group name if
120       a node belongs to a group. Otherwise undef is returned.
121
122       If an argument is supplied then this is set as the group name.
123
124       All group names are always lowercased.
125
126       For example, Apple Address book used 'itemN' to group it's custom
127       X-AB... nodes with a TEL or ADR node.
128
129   export_data()
130       NOTE: This method is deprecated and should not be used.  It will be
131       removed in a later version.
132
133         my $value = $node->export_data();
134
135       This method returns the value string of a node.  It is only needs to be
136       called when exporting the information back out to ensure that it has
137       not been altered.
138
139   as_string
140       Returns the node as a formatted string.
141
142   NOTES
143       If a node has a param of 'quoted-printable' then the value is escaped
144       (basically converting Hex return into \r\n as far as I can see).
145

AUTHOR

147       Leo Lapworth, LLAP@cuckoo.org Eric Johnson (kablamo), github ~!at!~
148       iijo dot org
149

SEE ALSO

151       Text::vCard Text::vCard::Addressbook, vCard vCard, vCard::AddressBook
152       vCard::AddressBook,
153
154
155
156perl v5.34.0                      2021-07-23              Text::vCard::Node(3)
Impressum