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   unit()
54         my @units = @{$org_node->unit()};
55         $org_node->unit(['Division','Department','Sub-department']);
56
57       As ORG allows unlimited numbers of 'units' as well as and organisation
58       'name', this method is a specific case for accessing those values, they
59       are always returned as an array reference, and should always be set as
60       an array reference.
61
62   types()
63               my @types = $node->types();
64               or
65               my $types = $node->types();
66
67       This method will return an array or an array ref depending on the
68       calling context of types associated with the $node, undef is returned
69       if there are no types.
70
71       All types returned are lower case.
72
73   is_type()
74         if($node->is_type($type) {
75               # ...
76         }
77
78       Given a type (see types() for a list of those set) this method returns
79       1 if the $node is of that type or undef if it is not.
80
81   is_pref();
82         if($node->is_pref()) {
83               print "Prefered node"
84         }
85
86       This method is the same as is_type (which can take a value of 'pref')
87       but it specific to if it is the prefered node. This method is used to
88       sort when returning lists of nodes.
89
90   add_types()
91        $address->add_types('home');
92
93        my @types = qw(home work);
94        $address->add_types(\@types);
95
96       Add a type to an address, it can take a scalar or an array ref.
97
98   remove_types()
99        $address->remove_types('home');
100
101        my @types = qw(home work);
102        $address->remove_types(\@types);
103
104       This method removes a type from an address, it can take a scalar or an
105       array ref.
106
107       undef is returned when in scalar context and the type does not match,
108       or when in array ref context and none of the types match, true is
109       returned otherwise.
110
111   group()
112         my $group = $node->group();
113
114       If called without any arguments, this method returns the group name if
115       a node belongs to a group. Otherwise undef is returned.
116
117       If an argument is supplied then this is set as the group name.
118
119       All group names are always lowercased.
120
121       For example, Apple Address book used 'itemN' to group it's custom
122       X-AB... nodes with a TEL or ADR node.
123
124   export_data()
125         my $value = $node->export_data();
126
127       This method returns the value string of a node.  It is only needs to be
128       called when exporting the information back out to ensure that it has
129       not been altered.
130
131   NOTES
132       If a node has a param of 'quoted-printable' then the value is escaped
133       (basically converting Hex return into \r\n as far as I can see).
134
135   EXPORT
136       None by default.
137

AUTHOR

139       Leo Lapworth, LLAP@cuckoo.org
140

SEE ALSO

142       Text::vCard Text::vCard::Addressbook
143
144
145
146perl v5.12.0                      2010-01-24              Text::vCard::Node(3)
Impressum