Perl

Para usar LiteSync con Perl debemos hacer 2 cosas:

1. Reemplazar la librería de SQLite preinstalada con el que compilamos el cual contiene el LiteSync.

2. Compila el DBD:SQLite para usar el módulo SQLite instalado:


Linux

wget http://search.cpan.org/CPAN/authors/id/I/IS/ISHIGAKI/DBD-SQLite-1.54.tar.gz

tar zxvf DBD-SQLite-1.54.tar.gz

cd DBD-SQLite-1.54

sed -i 's/if ( 0 ) {/if ( 1 ) {/g' Makefile.PL

perl Makefile.PL USE_LOCAL_SQLITE=0 SQLITE_LOCATION=/usr

make

sudo make install


Windows

Para hacer


Uso

Luego podemos usar el DBI / módulo DBD:SQLite normalmente, pasando un especial URI.

Código de Ejemplo:

use DBI;

my $dbh = DBI->connect("dbi:SQLite:uri=file:data.db?node=secondary&connect=tcp://server:port")

$dbh->do('CREATE TABLE t1 (id, name)');

$dbh->do('INSERT INTO t1 VALUES (1, "Hello World!")');

# wait for the new data to be replicated - only needed if the app will be closed

sleep(5);

print "done\n";