Syntax::RTF(3)

                            my $x = $Embperl::req -> component -> code ;
                            my ($op, $cmp, $a, $b) = XML::Embperl::DOM::Node::iChildsText (%$q%,%$x%,1) =~ /\:([=<>])+\s*\"(.*?)\"(?:\s*\"(.*?)\"\s*\"(.*?)\")?/ ;

                            if ($op eq '=') { $op = 'eq' }
                            elsif ($op eq '<') { $op = 'lt' }
                            elsif ($op eq '>') { $op = 'gt' }
                            elsif ($op eq '>=') { $op = 'ge' }
                            elsif ($op eq '<=') { $op = 'le' }

                            print "\n#" . __LINE__ . " op = $op cmp = $cmp a = $a b = $b code=$_ep_rtf_code tmp=$_ep_rtf_tmp 0=$param[0]{'adressen_anrede'} ndx=$_ep_rtf_ndx eval=qq[$_ep_rtf_code]\n" ;
                            $_ep_rtf_code =~ s/\$a/q\[$a\]/g ;
                            $_ep_rtf_code =~ s/\$b/q\[$b\]/g ;
                            $_ep_rtf_code =~ s/\$cmp/q\[$cmp\]/g ;
                            $_ep_rtf_code =~ s/\$op/$op/g ;
                            $_ep_rtf_code =~ s/\$x/$x/g ;
                            print "result=$_ep_rtf_code\n" ;

                            warn "RTF IF syntax error. Missing operator" if (!$op) ;

NAME
Embperl::Syntax::RTF

SYNOPSIS

DESCRIPTION
Class derived from Embperl::Syntax to define the syntax for RTF files. RTF files can be read and written by various word processing programms. This allows you to create dynamic wordprocessing documents or let process serial letters thru Embperl.

Currently Embperl regocnices the fields "DOCVARIABLE", "MERGEFIELD" and "NEXT". Variablenames are resolved as hash keys to $param[0] e.g. "foo.bar" referes to "$param[0]{foo}{bar}", the @param Array can by set via the "param" parameter of the "Execute" function. "NEXT" moves to the next element of the @param array. If the end of the document is reached, Embperl repeats the document until all element of @param are processed. This can for example be use to tie a database table to @param and generate a serial letter.

NOTE: Extenting this syntax to support full Embperl support (like embedding Perl into RTF file is planned, but not implemented yet)

Example for generating a serial letter from a database
  use DBIx::Recordset ;
  use Embperl ;

  *set = DBIx::Recordset -> Search({'!DataSource' => $db, '!Table' => 'address', '!WriteMode' => 0}) ;

  die DBIx::Recordset -> LastError if (DBIx::Recordset -> LastError) ;

  Embperl::Execute ({'inputfile' => 'address.rtf', param => \@set, syntax => 'RTF'}) ;

  # if your database table contains fields 'name' and 'street' you can now simply insert a
  # fields call 'name' and 'street' in your RTF file and Embperl will repeat the document
  # until all records are outputed

Methods
Embperl::Syntax::RTF defines the following methods:

  Embperl::Syntax::RTF -> new / $self -> new
Create a new syntax class. This method should only be called inside a constructor of a derived class.

  AddRTFCmd ($cmdname, $procinfo)
Add a new RTF command with name $cmdname and use processor info from $procinfo. See Embperl::Syntax for a definition of procinfo.

  AddRTFCmdWithEnd ($cmdname, $endname, $procinfo)
Add a new RTF command with name $cmdname and use processor info from $procinfo. Addtionaly specify that a matching $endname RTF command must be found to end the block, that is started by this RTF command. See Embperl::Syntax for a definition of procinfo.

  AddRTFCmdBlock ($cmdname, $endname, $procinfostart, $procinfoend)
Add a new RTF command with name $cmdname and and a second RTF command $endname which ends the block that is started by $cmdname. Use processor info from $procinfo. See Embperl::Syntax for a definition of procinfo.

Author
G. Richter (richter@dev.ecos.de)

See Also
Embperl::Syntax

POD ERRORS
Hey! The above document had some coding errors, which are explained below:

Around line 431:
    =pod directives shouldn't be over one line long! Ignoring all 15 lines of content

Around line 632:
    =pod directives shouldn't be over one line long! Ignoring all 2 lines of content