|
Posted by pdc124 on September 2, 2007, 5:24 am
Please log in for more thread options
Im trying to write data to the palm Datebook file ( adn then sync the
new information a bit later)
I create an emptry datebook
use strict;
use Data::Dumper;
use Palm::PDB;
use Palm::Datebook;
my $pdb = new Palm::Datebook;
my $filename='/tmp/palm/DatebookDB.pdb';
$pdb->Write($filename) or die " cant write file"; exit;
which creates a Datebook
paul@skippy /tmp/palm $ ls -ls |grep DatebookDB.pdb
4 -rw-r--r-- 1 paul paul 360 Sep 2 10:05 DatebookDB.pdb
I can then read the records ( and get nothing )
$pdb->Load($filename) or die " cant load file";
my $nums = @};
print "printing records\n---------------------\n";
for ( my $i=0; $i<$nums; $i++ ) {
print "$i : ";
my $record = $pdb->[$i];
print " $record->-$record->-$record->: $record-
> $record-> to $record->$record-
> ";
print "$record-> ";
print "$record->";print "\n";
}
exit;
I then try and write new record to the file
{
my $newrecord = $pdb->new_Record;
$newrecord->="13";$newrecord->="9";
$newrecord-> ="2007";
$newrecord-> ="another test entry";
$newrecord->="11"; $newrecord->="10";
$newrecord->="11"; $newrecord->="20";
$newrecord->="testnote";
print Dumper($newrecord);
$pdb->append_Record or die " cant add record";
$pdb->Write("/tmp/palm/DatebookDB.pdb") or die " cant write file";;
}
has this output
paul@skippy /tmp/palm $ ./readdb.pl
printing records
---------------------
$VAR1 = {
'exceptions' => [],
'month' => '9',
'end_minute' => '20',
'description' => 'another test entry',
'start_minute' => '10',
'note' => 'testnote',
'end_hour' => '11',
'day' => '13',
'repeat' => {},
'alarm' => {
'advance' => 10,
'unit' => 0
},
'start_hour' => '11',
'category' => 0,
'id' => 0,
'attributes' => {
'Dirty' => 1,
'dirty' => 1
},
'year' => '2007'
};
paul@skippy /tmp/palm $
the file has changed in size
paul@skippy /tmp/palm $ ls -ls |grep DatebookDB.pdb
4 -rw-r--r-- 1 paul paul 378 Sep 2 10:12 DatebookDB.pdb
and when i try to read this data back i get this
printing records
---------------------
Use of uninitialized value in concatenation (.) or string at ./
readdb.pl line 28.
Use of uninitialized value in string at ./readdb.pl line 29.
0 : 2007-9-2: 255 255 to 255255
paul@skippy /tmp/palm $
ie its added to the file an entry for today (Sep2 ) . Hexdump of
Datebook.pdb has no 13 anywhere that I can find
and when i sync this file with my palm i get nothing on Sep13
anyone tell me where ive gone wrong ?
|
|
Posted by pdc124 on September 2, 2007, 1:05 pm
Please log in for more thread options
looking in /usr/lib/perl5/site_perl/5.8.8/Palm
its says this so my new record is being created with the default
values .
I wonder why
sub new_Record
{
my $classname = shift;
my $retval = $classname->SUPER::new_Record(@_);
# By default, the new record is an untimed event that occurs
# today.
my @now = localtime(time);
$retval-> = $now[3];
$retval-> = $now[4] + 1;
$retval-> = $now[5] + 1900;
$retval-> =
$retval-> =
$retval-> =
$retval-> = 0xff;
# Set the alarm. Defaults to 10 minutes before the event.
$retval-> = 10;
$retval-> = 0; # Minutes
$retval-> = {}; # No repeat
$retval-> = []; # No exceptions
$retval-> = "";
$retval-> = undef;
return $retval;
}
|
| Similar Threads | Posted | | Palm Desktop | February 7, 2005, 6:55 pm |
| Problem with Net::FTP | July 21, 2004, 12:40 pm |
| DBI - DBD-DB2 Problem - Please help | June 2, 2005, 11:07 pm |
| Net::FTP->problem with put | February 28, 2006, 2:11 am |
| Re: Problem with DBD::DB2 on AIX. | September 20, 2006, 2:10 pm |
| net::telnet problem | July 23, 2004, 6:46 pm |
| Lwp Post Problem | September 1, 2004, 4:09 am |
| DBD-Pg installation problem | September 20, 2004, 10:34 pm |
| SSL LWP Timeout problem | September 21, 2004, 2:25 pm |
| Win32::API problem... | May 25, 2005, 5:33 pm |
|