[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re[2]: [coldsync-hackers] Writing conduits that read more then one DB.
Friday, June 6, 2003, 12:17:34 PM, you wrote:
IB> This is similar to my thinking, although I never thought of the possibility of
IB> allowing users to specify just the DB name without the path. If I take that
IB> approach, then I could do something like this:
IB> # Set default values
IB> %HEADERS = (
IB> File => "./TitraxTestOutput.txt"
IB> DBpath => InputDB =~ /(.*)\/.*$/
IB> Datebookdb => "DatebookDB.pdb"
IB> TitraxNoteDB => "TitraxNoteDB.pdb"
IB> TitraxDataDB => "TitraxDataDB.pdb"
IB> );
IB> Or not. This produces a syntax error. I'm guessing you can't set a hash
IB> value like this, or am I doing it wrong? Oh well, I'll just set DBpath from
IB> within my dump function. Unless there is a way to do what I'm trying here?
You need commas after the values.
The operator => is just a fancy comma, with the side affect that if
what's to the the left of it is a valid identifier, it gets
doublequoted. So, saying foo => "bar" is the same as "foo", "bar"
which gives you commas after your keys. But you ALSO need commas
after the values:
%HEADERS = (
File => "./TitraxTestOutput.txt",
DBpath => InputDB =~ /(.*)\/.*$/,
Datebookdb => "DatebookDB.pdb",
TitraxNoteDB => "TitraxNoteDB.pdb",
TitraxDataDB => "TitraxDataDB.pdb",
);
You'll notice a stray comma on the last one. This is a non-error in
perl, and convenient if you ever add more entries to the hash, because
the comma is "already there" and prevents the syntax errors you saw.
HTH!
L8r,
Rob
--
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.