=Tlpp examples ==Simple ones... \: .1 it is good to be able to to abreveiations \def\minho{http://www.di.uminho.pt} .2 and comments: \def\c#1{} \c accept an argumente a guives nothing .3 a link: \def\link#2{ #1 } can be used like: \link{my home}{\minho/~jj} and would produce: my home .4 mail (makes a link with name arg1 and address mailto:arg1) \def\mail#1{\l{#1}{mailto:#1}} .5 date (execute `date` in perl) \perl(`date`) .6 command \endings to end my pages \def\endings{

José João Dias Almeida \mail{jj@di.uminho.pt}
\perl{`date`}
} ==Example: build forms to read and send dada by mail Will write a style to define a new environment "mailto" to ask for some data and mail it to an address. Style file: % form: command to read data \def\in#2{#1
} % predefined field (body of the mail) \def\corpo#1{} % environment mailto parameters: address_to, subject \newenvironment{mailto}[2]{

}{

} Example of use: \begin{mailto}{jj@di.uminho.pt}{paper submission for...} \in{org: }{my_org} \in{nnme: }{my_name} \in{telefone: }{my_tel} \corpo{Dear sirs, I'm going to submit... name: \my_name orga: \my_org tele: \my_tel Um abraço do \my_name} \end{mailto} html code produced:

org:

name:

telefone:


The cgi_bin script "jjmailto" that processes the messages is generic and can be use by any nonpreveliged user. The main ideia is: . build a text with \def pairs "\my_..." value followed by the \corpo_ invocation . send it to tlpp for \my... expantion . send the result to mail ... jjmailto (ignoring the feedback stuff): #!/usr/local/bin/perl ... [traditional CGI_bin arg. processing] ... [putting the field in array "f"] $mail_to_= $ARGV[0]; $sub= ($f{"sub"})?$f{"sub"}:"empty subject"; open(O1,"|$jj/tlpp |/usr/ucb/mail -s '$sub' $mail_to_"); select(O1); # send the "\def\my_...{...}" definitions foreach (keys %f) { printf "\\def\\$_\{$f{$_}\} ";} print "\\corpo_ \n"; close(O1);