[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [coldsync-hackers] Perl question



Well, there are a bunch of fields that might not be filled in - take for example 
the company name field in the address book

If I want to check to see if it has changed on the Palm or on the server I also 
need to check to see if they are not null

if ( defined($record->{fields}{company}) && defined($cal->{org_name}) ) {
  if ( $record->{fields}{company} ne $cal->{org_name} ) {
    print STDERR "The records do not match\n";
  }
} elsif ( defined($record->{fields}{company}) && !defined($cal->{org_name}) ) {
    print STDERR "The records do not match\n";
} elsif ( !defined($record->{fields}{company}) && defined($cal->{org_name}) ) {
    print STDERR "The records do not match\n";
}

If I just check them against each other directly, I get 'uninitialized variables' 
errors when the field is not used

There's got to be an easier way to do this since there are about 20 pairs of fields 
to check in the addressbook app


Alex Tronin (at@urbis.net) wrote: 
>
>How about using defined() ?
>It tells you is it NULL or not

-----
Brian Johnson, P. Eng.
Johnson Engineering Consultants
www.jecinc.on.ca

-- 
This message was sent through the coldsync-hackers mailing list.  To remove
yourself from this mailing list, send a message to majordomo@thedotin.net
with the words "unsubscribe coldsync-hackers" in the message body.  For more
information on Coldsync, send mail to coldsync-hackers-owner@thedotin.net.