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

[coldsync-hackers] Re: fetch conduit does not update pdb



 On 03-Nov-02 at 23:00:00,
  Peer Oliver Schmidt <pos@theinternet.de> wrote:


> after fixing the previous problems, due to some misconfiguration of Perl
> due to operator error (i.e. me), I have a problem with a fetch conduit for
> to dos. My dump conduits work fine, but the following todo-fetch.pm does
> not work, and I have no clue why?

> Using the latest CVS version.

> #!/usr/bin/perl
> #----------------------------------------
> #
> # For access to the Palm
> use Palm::PDB;
> use Palm::ToDo;  
> use ColdSync;
> use ColdSync::SPC;
> # For access to the database system
> $pdb = new Palm::ToDo;
> StartConduit("fetch");
> $pdb->Load($HEADERS{"OutputDB"});
> $pdb_record = $pdb->append_Record;
> $pdb_record->{Description} = "Hallo";
> $pdb_record->{Priority} = 5;
> EndConduit("fetch");
> exit 0;

> Shouldn't this create a new todo? I know it did work a few month ago, but
> I have no idea when in stopped working.

> Question to the list is: Is the above way correct to add a single entry to
> the to do list? What am I missing here? Do I have ->load the PDB
> explicitly or is this part of StartConduit("fetch")?

StartConduit will Load for you, but from InputDB. OutputDB will be written
 (and eventually created) by EndConduit.

you don't need to call new Palm::ToDo. Just use the $PDB (all uppercase)
global variable. 

this one should work (untested):

use strict;
use Palm::ToDo;
use ColdSync;

    StartConduit('fetch');

    my $new_record = $PDB->append_Record;

    $new_record->{'Description'} = "Hallo";

    EndConduit();

However you can have troubles if the InputDB doesn't exists: Load
will not be called and your $PDB will be a Palm::PDB and not a Palm:ToDo.

You can check if InputDB is undefined and
eventually do something like:

    $PDB = new Palm::ToDo;

You can use the dump-headers conduit to check your environment.

-- 

  - alex.



-- 
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.