develooper Front page | perl.perl6.language | Postings from June 2005

using rules

Thread Next
From:
=?iso-8859-2?Q?B=C1RTH=C1ZI_Andr=E1s?=
Date:
June 3, 2005 01:30
Subject:
using rules
Message ID:
Pine.LNX.4.61.0506031015310.15410@wish.hu
Hi,

I'm working on a web templating system, and I'm wondering how should I use 
rules?

I have these defs:

rule elem {
 	\< wts \: (<[a..z]>+) \/ \>
}

rule block {
 	\< wts \: (<[a..z]>+)\>(.*?)\< \/ wts \: $1 \>
}

I would like to execute subroutines during the evaluation. What should I 
do? Is the following the right way?

  given $template {

    s/<block>/{trigger_block()}/;
    s/<elem>/{trigger_elem()}/;

  }

How can I catch the matched elem name, and block content? I'm guessing 
that hypotetical variables can be the solution, but it says, that those 
variables should have been defined, before I use them, and it's not that 
case.

Bye,
   Andras

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About