Gmane
From: BÁRTHÁZI András <andras <at> barthazi.hu>
Subject: using rules
Newsgroups: gmane.comp.lang.perl.perl6.language
Date: 2005-06-03 08:30:04 GMT (3 years, 12 weeks, 2 days, 8 hours and 30 minutes ago)
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