Hello,
here is sample perl code, to illustrate the debate : it prints itself
using the lyx server.
========================================================================
#!/usr/bin/perl -w
#
# Usage : Edit this file so that variable "$lyxpipe" is the name of
# the lyx pipe.
# Then run while lyx is running, with server enabled.
# (the "\serverpipe XXX" is uncommented in ~/.lyx/lyxrc.
#
# With option -w and 'use diagnostics', perl is easy to debug.
#
$mylyxpipe = "$ENV{HOME}/.lyx/lyxpipe.in" ;
use diagnostics ;
open LYXIN, ">$mylyxpipe" or
die "Unable to open lyxpipe.in" ;
# Safe : check that pipe is really open.
print LYXIN "LYXCMD:test:file-new:dummy.lyx\n" ;
print LYXIN "LYXCMD:test:font-code:\n" ;
chomp($filename = `pwd`) ;
$0 =~ s{\./}{}g ;
$filename .= "/$0" ;
open MYCODE, "<$filename" ;
while( defined( $line = <MYCODE> ) ){
$line =~ s/\t+/ /g ; # Catch tabs
$line =~ s/ /../g ; # Fake multiple spaces
print LYXIN "LYXCMD:test:self-insert:$line" ;
print LYXIN "LYXCMD:test:break-line:\n" ;
}
close MYCODE ;
close LYXIN ;
==========================================================================
Cheers,
Etienne