1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/perl
use strict;
use warnings;
use POSIX;
use Switch;
use Text::vCard::Addressbook;
...
my $node_n = $vcard->get({ 'node_type' => 'N' })->[0];
print STDERR " " . $node_n->given() if (defined $node_n->given);
QuoteCan't call method "given" on an undefined value at /var/www/html/phonebook.xml line xxx.
1
2
3
if (defined $node_n) {
print STDERR " " . $node_n->given() if defined $node_n->given;
}
print STDERR " " . $node_n->given() if defined $node_n->given;
print STDERR " " . $node_n->given() if defined ($node_n->given);