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

[coldsync-hackers] Perl question



I'm writing a conduit for the Palm addressbook and there are a lot of fields that 
might not be filled in on the Palm.  This also means that my server app (a 
database) should also not have entries in some fields

When I try to determine if records have changed, I end up doing something like
if( $record->{firstname} ne $item->{firstname} ) {
  $changed = 'yes'
}

I use this as a simply example where $record is from the .PDB and $item is from the 
database (I didn't actually look up the correct field names for this example)

When I do this, there is the possibility that one or both of the variables might be 
nulls resulting in using uninitialized variables errors.

It's possible that both variables could be null and then that would be considered a 
false in this if statement (ie they do equal each other, they're both null)

I there a simply, code efficient way to prevent the errors and still check whether 
the variables match 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.