[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[coldsync-hackers] Problems with Palm::Datebook
- To: coldsync-hackers at lusars dot net
- Subject: [coldsync-hackers] Problems with Palm::Datebook
- From: "Shawn L." <hyloth at yahoo dot com>
- Date: Thu, 16 Oct 2003 04:56:27 -0700 (PDT)
- Reply-to: coldsync-hackers at lusars dot net
- Sender: owner-coldsync-hackers at lusars dot net
Hey everyone.. I'm new to the p5-palm package, so I'm
hoping I'm missing one small detail after reading and
googling. I'm trying to insert dates into the
datebook, but it keeps telling me that the records are
empty everytime I do it. Here is my code:
#!C:\Perl\bin\perl.exe
use Palm::Datebook;
use Palm::StdAppInfo;
use LWP::UserAgent;
use Data::Dumper;
use strict;
################ SETUP ##########################
### Change this to whatever your BACKUP directory
is.... i.e.
### C:\Palm\Name\Backup\
my $data_directory = 'C:\Progra~1\Palm\Shawn\Backup';
### The url the games list is at
my $url = "http://someurl.com/palm_games.txt";
################# END OF SETUP ##################
### Create a pdb to sync
my $pdb = new Palm::StdAppInfo;
### Create a user agent object
my $ua = LWP::UserAgent->new;
$ua->agent("GameGrabber/0.1");
### Create a request
my $req = HTTP::Request->new(GET => $url);
### Pass a request to the user agent and get a
response back.
my $res = $ua->request($req);
### Save the contents of the page in a scalar
my $text = $res->content;
foreach my $line (split(/\n/, $text)) {
###
my $record = $pdb->append_Record;
my @game = split(/\|/, $line);
$game[0] =~ m/(\d+)\.(\d+)\.(\d+)/;
## Specify Day
my ($day, $month, $year) = ($2, $1, $3);
$record->{"day"} = $day;
## Specify Month
$record->{"month"} = $month;
## Specify Year
$record->{"year"} = $year;
$record->{"description"} = $game[1];
$record->{"note"} = $game[2];
$record->{"alarm"} = {};
$record->{"start_hour"} = 255;
$record->{"start_minute"} = 255;
$record->{"end_hour"} = 255;
$record->{"end_minute"} = 255;
$record->{"category"} = 0;
$record->{"attributes"}{"dirty"} = 1;
}
$pdb->Write("$data_directory/DateBookDB.pdb");
##### END #####
Here is what it tells me everytime:
C:\Documents and Settings\Administrator\Desktop>perl
test.pl
at
C:/Perl/site/lib/Palm/PDB.pm line 1125.
Write: Warning: record 0x00000000 has length 0
1 at C:/Perl/site/lib/Palm/PDB.pm line 1187.
Write: Warning: record 0x00000000 has length 0
1 at C:/Perl/site/lib/Palm/PDB.pm line 1187.
Write: Warning: record 0x00000000 has length 0
1 at C:/Perl/site/lib/Palm/PDB.pm line 1187.
Any help would be greatly appreciated.
Thanks,
looker
__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com
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.