Front page | perl.perl6.language |
Postings from June 2005
Re: using rules
Thread Previous
From:
BÁRTHÁZI András
Date:
June 5, 2005 06:34
Subject:
Re: using rules
Message ID:
42A2FF03.6020000@barthazi.hu
Hi,
No ideas?
Bye,
Andras
> 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.
Thread Previous