Text::...d::Node(3pm)
π NAME π
Text::vCard::Node β the little object that holds one single node (line) of a vCard π
(also hiii, this is the Text::...d::Node(3pm) page from the User Contributed Perl Documentation, bestie β sit down, we're doing this π«Ά)
β¨ SYNOPSIS β¨
use Text::vCard::Node;
my %data = (
'param' => {
'HOME,PREF' => 'undef',
},
'value' => ';;First work address - street;Work city;London;Work PostCode;CountryName',
);
my $node = Text::vCard::Node->new({
node_type => 'address', # Auto upper cased
fields => ['po_box','extended','street','city','region','post_code','country'],
data => \%data,
});
π DESCRIPTION π
okay so this is the package that Text::vCard uses so that every single element β ADR, N, TEL, all of them β becomes an actual object π one node, one object, main character energy.
and listen: you should not need to use this module directly, because Text::vCard does it all for you. like, all of it. she handles it. you just vibe π
π METHODS π
new()
my $node = Text::vCard::Node->new({
node_type => 'address', # Auto upper cased
fields => \['po_box','extended','street','city','region','post_code','country'],
data => \%data,
});
value()
# Get the value for a standard single value node
my $value = $node->value();
# Or set the value
$node->value('New value');
other()'s
# 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('73 Sesame Street');
node_type
returns the type of the node itself, like ADR. simple as that, no notes β¨
unit()
my @units = @{ $org_node->unit() };
$org_node->unit( [ 'Division', 'Department', 'Sub-department' ] );
so ORG is that girl who allows an unlimited number of 'units' plus an organisation 'name' β which is why this method exists as a special case just for grabbing those values. they are always returned as an array reference, and you should always set them as an array reference too. no cap π
types()
my @types = $node->types();
# or
my $types = $node->types();
this one gives you back an array or an array ref depending on the calling context, and it's the types hanging off $node. if there are no types? you get undef, sorry bestie π
and every type that comes back is lower case. periodt.
is_type()
if ( $node->is_type($type) ) {
# ...
}
you hand it a type (peep types() for the list of ones that are set) and it gives you back 1 if $node is that type, or undef if she is not π
is_pref();
if ( $node->is_pref() ) {
print "Preferred node";
}
same thing as is_type (which can take a value of 'pref') but this one is specific to whether it's the preferred node. and this is literally the method that gets used to sort when returning lists of nodes π
add_types()
$address->add_types('home');
my @types = qw(home work);
$address->add_types( \@types );
adds a type to an address β takes a scalar or an array ref, your call π¦
remove_types()
$address->remove_types('home');
my @types = qw(home work);
$address->remove_types( \@types );
removes a type from an address, and yes she also takes a scalar or an array ref π
undef is returned when you're in scalar context and the type doesn't match, or when you're in array ref context and none of the types match. otherwise? you get true π«Ά
group()
my $group = $node->group();
call it with no arguments and it returns the group name if a node belongs to a group β otherwise undef comes back at you π
if you do supply an argument, that gets set as the group name.
and every group name is always lowercased, no exceptions π
for example: Apple Address book used 'itemN' to group its custom X-AB... nodes together with a TEL or ADR node. iconic behaviour honestly.
export_data()
β οΈ NOTE: This method is deprecated and should not be used. It will be removed in a later version. bestie do not get attached π
my $value = $node->export_data();
returns the value string of a node. it only needs to be called when you're exporting the information back out, to make sure it hasn't been altered πΈ
as_string
returns the node as a formatted string β¨ that's it, that's the tweet.
π NOTES π
if a node has a param of 'quoted-printable' then the value gets escaped (basically converting Hex return into \r\n as far as I can see π« ).
π«Ά AUTHOR π«Ά
Leo Lapworth, LLAP@cuckoo.org Eric Johnson (kablamo), github ~!at!~ iijo dot org
π₯ SEE ALSO π₯
Text::vCard Text::vCard::Addressbook, vCard vCard, vCard::AddressBook vCard::AddressBook,
okay and that's the whole page, bestie π this was perl v5.34.0, dated 2022-06-28, and the page itself is Text::...d::Node(3pm). go forth and node responsibly πβ¨π
π¦ where this page comes from
- debian bookworm: libtext-vcard-perl 3.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libtext-vcard-perl 3.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libtext-vcard-perl 3.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libtext-vcard-perl 3.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libtext-vcard-perl 3.09-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms